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

【题意】

在这里输入题意

【题解】

绕(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. @ConfigurationProperties注解

    @Value获取值和@ConfigurationProperties获取值比较 |            | @ConfigurationProperties | @Value | | ------- ...

  2. HDU 3718 Similarity(KM最大匹配)

    HDU 3718 Similarity 题目链接 题意:给定一个标准答案字符串,然后以下每一行给一个串.要求把字符一种相应一种,要求匹配尽量多 思路:显然的KM最大匹配问题,位置相应的字符连边权值+1 ...

  3. 抽象类(Abstract)和接口的不同点、共同点(Interface)。

    同样点: (1) 都能够被继承 (2) 都不能被实例化 (3) 都能够包括方法声明 (4) 派生类必须实现未实现的方法 区 别: (1) 抽象基类能够定义字段.属性.方法实现.接口仅仅能定义属性.索引 ...

  4. 学习笔记——DISTINCT

    DISTINCT印象中向来被人诟病,说它效率低下.但网上那些SQL 面试题答案,却时有用之.其中 COUNT(DISTINCT 句式,我以前很少用,这里做个笔记. 为管理岗位业务培训信息,建立3个表: ...

  5. Codeforces Round #330 (Div. 2)B. Pasha and Phone 容斥

    B. Pasha and Phone   Pasha has recently bought a new phone jPager and started adding his friends' ph ...

  6. HDU 5692 Snacks(DFS序+线段树)

    Snacks Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Sub ...

  7. bzoj 1556 墓地秘密 —— 状压DP

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1556 预处理出两个障碍四个方向之间的距离(转弯次数),就可以状压DP了: 但预处理很麻烦.. ...

  8. 洛谷 P3959 NOIP2017 宝藏 —— 状压搜索

    题目:https://www.luogu.org/problemnew/show/P3959 搜索: 不是记忆化,而是剪枝: 邻接矩阵存边即可,因为显然没有那么多边. 代码如下: #include&l ...

  9. Python入门 六、像个 Pythonista

    pickle import pickle test_data = ['Save me!',123.456,True] f = file('test.data','w') pickle.dump(tes ...

  10. 关于我们ajax异步请求的方法与知识

      做前端开发的朋友对于ajax异步更新一定印象深刻,作为刚入坑的小白,今天就和大家一起聊聊关于ajax异步请求的那点事.既然是ajax就少不了jQuery的知识,推荐大家访问www.w3school ...