【链接】 我是链接,点我呀:)

【题意】

在这里输入题意

【题解】

绕(x,y,z)三个轴旋转。
枚举x,y,z各4次的结果。
(4次之后能还原。可以方便上一层枚举下一个情况。)

【代码】

#include <bits/stdc++.h>
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
using namespace std; const int N = 12; char s[N+10];
char s1[N+5],s2[N+5];
int ope[3][4]={
{1,2,6,5},
{2,4,5,3},
{1,4,6,3}
}; void operation(int p){
char key = s2[ope[p][3]];
rep2(i,3,1) s2[ope[p][i]] = s2[ope[p][i-1]];
s2[ope[p][0]] = key;
} bool judge(){
for (int i = 1;i <= 4;i++){
operation(0);
for (int j = 1;j <= 4;j++){
operation(1);
for (int k = 1;k <= 4;k++){
operation(2);
int ok = 1;
rep1(kk,1,6)
if (s1[kk]!=s2[kk]){
ok = 0;
break;
}
if (ok){
return true;
}
}
}
}
return false;
} int main(){
//freopen("/home/ccy/rush.txt","r",stdin);
// freopen("/home/ccy/rush_out.txt","w",stdout);
ios::sync_with_stdio(0),cin.tie(0);
while (cin >> (s+1)){
rep1(i,1,6) s1[i] = s[i];
rep1(i,7,12) s2[i-6] = s[i];
if (judge()){
cout<<"TRUE"<<endl;
}else{
cout<<"FALSE"<<endl;
}
}
return 0;
}

【习题 4-4 UVA - 253】Cube painting的更多相关文章

  1. UVA 253 Cube painting(暴力打表)

    Cube painting Problem Description: We have a machine for painting cubes. It is supplied with three d ...

  2. uva 253 - Cube painting(相同骰子)

    习题4-4 骰子涂色(Cube painting, UVa 253) 输入两个骰子,判断二者是否等价.每个骰子用6个字母表示,如图4-7所示. 图4-7 骰子涂色 例如rbgggr和rggbgr分别表 ...

  3. UVA 253 Cube painting

    大致题意:有三种颜色,一个立方体6面都可以涂一种颜色.现在给出两个每个面都涂好颜色的立方体,判断这两个立方体通过旋转是否相等. 立方体的旋转出来的结果有很多,首先可以0,1,2,3,4,5(顺序是:上 ...

  4. UVA 253 Cube painting(枚举 模拟)

    题意: 按如图的顺序给定2个骰子的颜色(只有r.b.g三种颜色) 问2个骰子是否一模一样 如 可表示为“rbgggr” 和 “rggbgr”, 第二个就是绕着Z轴顺时针旋转90度与第一个相同的骰子. ...

  5. UVa 253 Cube paiting

    题意:输入两个骰子,判断是否等价 因为每一个面可以作顶面,共6*4种情况,枚举就可以了 #include<iostream> #include<cstdio> #include ...

  6. UVA 253 (13.08.06)

     Cube painting  We have a machine for painting cubes. It is supplied withthree different colors: blu ...

  7. UVa 253

    UVa 253 #include <iostream> #include <cstdio> #include <string> #include <cstri ...

  8. Cube painting UVA - 253

     We have a machine for painting cubes. It is supplied with three different colors: blue, red and gre ...

  9. 骰子涂色 (Cube painting,UVa 253)

    题目描述:算法竞赛入门习题4-4  题目思路:1.旋转其中一个骰子进行匹配 2.进行遍历,如果匹配,就进行相对面的匹配 3.三个对立面都匹配即是一样等价的 //没有按照原题的输入输出 #include ...

随机推荐

  1. Oracle经典教程学习笔记

    Oracle学习 1.为表创建约束:alter table 表名 add constraint 约束名 约束内容 演示样例:alter bable infos add constraint UN_ST ...

  2. SerializeUtil 序列化,反序列化工具类

    package cloud.app.prod.home.utils; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutp ...

  3. LA4788

    贪心 这个贪心不太懂啊 dfs返回子树需要的最小值,然后按需要减消耗排序,然后贪心选取即可. #include<bits/stdc++.h> using namespace std; ty ...

  4. PCB Genesis增加点阵字 实现原理

    我们采用Genesis增加点阵字时,用Genesis增加Canned Text即可,但奥宝中文不支持,且字符种类是有限的呀 不过没关系,没有自己造呀.在这里我分享一种增加点阵字的实现方法 一.通过代码 ...

  5. C#发送电子邮件代码记录

    /// <summary> /// 发送电子邮件 /// </summary> /// <param name="Address">邮件地址&l ...

  6. C#:使用FastReport打印带图片传参模板的实现方法

    大家都知道,C#打印图片可以直接调用PrintDocument控件的PrintPage事件,通过画刷对image对象直接进行绘制.但是这种方法存在局限,例如如果打印的图片需要按纸张大小进行缩放的话,那 ...

  7. centos开机运行级别更改

    1.使用命令切换运行级别/目标 # systemctl isolate multi-user.target //切换到运行级别3,该命令对下次启动无影响,等价于telinit 3 # systemct ...

  8. NET MVC FileResult 导出/下载 文件/Excel

    参考http://www.cnblogs.com/ldp615/archive/2010/09/17/asp-net-mvc-file-result.html 1.引入NPOI 2.代码 using ...

  9. Overview of Polymorphism -多态的分类

    多态有类型系统衍生. 有限类型.无限类型.确定类型. Classifications Christopher Strachey (1967) introduced the concept of pol ...

  10. iOS https 证书链获取

    - (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)chall ...