博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
hdu 5983Pocket Cube(16青岛现场赛)一步能否还原二层魔方?
阅读量:4206 次
发布时间:2019-05-26

本文共 3924 字,大约阅读时间需要 13 分钟。

int a,b,c,d,ee,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x;int main(){    int T;    cin>>T;    while(T--)    {        cin>>a>>b>>c>>d>>ee>>f>>g>>h>>i>>j>>k>>l>>m>>n>>o>>p>>q>>r>>s>>t>>u>>v>>w>>x;        int flag=0;        if(u==v&&v==w&&w==x && q==r&&r==s&&s==t && m==o&&o==b&&b==d && n==p&&p==i&&i==k && j==l&&l==ee&&ee==g && f==h&&h==a&&a==c)flag=1;        if(u==v&&u==w&&u==x && q==r&&r==s&&r==t && a==c&&a==n&&a==p && m==o&&o==j&&j==l && i==k&&i==f&&i==h && ee==g&&g==b&&g==d)flag=1;        if(a==b&&a==c&&a==d && i==j&&i==k&&i==l && q==s&&q==ee&&q==f && g==h&&h==u&&h==w && x==v&&x==p&&x==o && m==n&&m==r&&m==t)flag=1;        if(a==b&&a==c&&a==d && i==j&&i==k&&i==l && q==s&&s==o&&s==p && m==n&&m==u&&m==w && v==x&&x==ee&&x==f && g==h&&g==r&&g==t)flag=1;        if(m==n&&m==o&&m==p && ee==f&&f==g&&f==h && s==t&&s==k&&s==l && i==j&&i==u&&i==v && w==x&&x==a&&x==b && c==d&&c==q&&c==r)flag=1;        if(m==n&&m==o&&m==p && ee==f&&f==g&&f==h && s==t&&s==a&&s==b && c==d&&c==u&&c==v && w==x&&x==k&&x==l && i==j&&i==q&&i==r)flag=1;        if(a==b&&b==c&&c==d && ee==f&&f==g&&g==h && i==j&&j==k&&k==l && m==n&&n==o&&o==p && q==r&&r==s&&s==t && u==v&&v==w&&w==x)flag=1;        if(flag)cout<<"YES"<

Pocket Cube

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1358    Accepted Submission(s): 509


Problem Description
The Pocket Cube, also known as the Mini Cube or the Ice Cube, is the 2 × 2 × 2 equivalence of a Rubik’s Cube.
The cube consists of 8 pieces, all corners.
Each piece is labeled by a three dimensional coordinate (h, k, l) where h, k, l ∈ {0, 1}. Each of the six faces owns four small faces filled with a positive integer.
For each step, you can choose a certain face and turn the face ninety degrees clockwise or counterclockwise.
You should judge that if one can restore the pocket cube in one step. We say a pocket cube has been restored if each face owns four same integers.
 

Input
The first line of input contains one integer N(N ≤ 30) which is the number of test cases.
For each test case, the first line describes the top face of the pocket cube, which is the common 2 × 2 face of pieces
labelled by (0, 0, 1),(0, 1, 1),(1, 0, 1),(1, 1, 1). Four integers are given corresponding to the above pieces.
The second line describes the front face, the common face of (1, 0, 1),(1, 1, 1),(1, 0, 0),(1, 1, 0). Four integers are
given corresponding to the above pieces.
The third line describes the bottom face, the common face of (1, 0, 0),(1, 1, 0),(0, 0, 0),(0, 1, 0). Four integers are
given corresponding to the above pieces.
The fourth line describes the back face, the common face of (0, 0, 0),(0, 1, 0),(0, 0, 1),(0, 1, 1). Four integers are
given corresponding to the above pieces.
The fifth line describes the left face, the common face of (0, 0, 0),(0, 0, 1),(1, 0, 0),(1, 0, 1). Four integers are given
corresponding to the above pieces.
The six line describes the right face, the common face of (0, 1, 1),(0, 1, 0),(1, 1, 1),(1, 1, 0). Four integers are given
corresponding to the above pieces.
In other words, each test case contains 24 integers a, b, c to x. You can flat the surface to get the surface development
as follows.
+ - + - + - + - + - + - +| q | r | a | b | u | v |+ - + - + - + - + - + - +| s | t | c | d | w | x |+ - + - + - + - + - + - +        | e | f |        + - + - +        | g | h |        + - + - +        | i | j |        + - + - +        | k | l |        + - + - +        | m | n |        + - + - +        | o | p |        + - + - +
 

Output
For each test case, output YES if can be restored in one step, otherwise output NO.
 

Sample Input
41 1 1 12 2 2 23 3 3 34 4 4 45 5 5 56 6 6 66 6 6 61 1 1 12 2 2 23 3 3 35 5 5 54 4 4 41 4 1 42 1 2 13 2 3 24 3 4 35 5 5 56 6 6 61 3 1 32 4 2 43 1 3 14 2 4 25 5 5 56 6 6 6
 

Sample Output
YESYESYESNO
 

Source
 

Recommend
jiangzijing2015   |   We have carefully selected several similar problems for you:            
 

 |   |   | 

转载地址:http://oeali.baihongyu.com/

你可能感兴趣的文章
Velocity 模板基本用法
查看>>
SpringMVC 使用总结
查看>>
Mybatis 出现Mapped Statements collection does not contain value for xxx
查看>>
Mybatis 解决字段名与实体类属性名不相同的冲突
查看>>
Mybatis Generator最完整配置详解
查看>>
Mybatis 一级缓存和二级缓存
查看>>
Hibernate 出现Unsupported major.minor version 52.0 [duplicate]
查看>>
Hibernate 使用Intellij IDEA自动生成.hbm.xml文件
查看>>
Hibernate 出现org.hibernate.MappingNotFoundException: resource:**.hbm.xml not found问题的解决方案
查看>>
Hibernate 注解使用总结
查看>>
JAVA 事务之JDBC事务、JTA事务和容器事务
查看>>
EJB 是什么
查看>>
Hibernate 异常StrategySelectionException: Unable to resolve name EhCacheRegionFactory
查看>>
Hibernate 异常CacheException: Another unnamed CacheManager already exists in the same VM
查看>>
Python 常用的几种安装Module方式
查看>>
Mongodb 创建用户后登陆出现mongoAuthentication failed
查看>>
Mongodb GridFS、服务器脚本和数据库引用
查看>>
Mongodb 数据库管理
查看>>
JAVA 基本类型的默认值和取值范围
查看>>
JDK 1.5-1.8特性
查看>>