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

【题意】

在这里输入题意

【题解】

绕(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. 严格符合CommonJS规范的包特性

    严格符合CommonJS规范的包应该具备下面特性: 1.package.json必须在包的顶层文件夹下. 2.二进制文件应该在bin文件夹下. 3.JavaScript代码应该在lib文件夹下. 4. ...

  2. Android+Jquery Mobile学习系列(8)-保单/生日提醒功能

    其实这个App基本功能早已做完,并且交给老婆试用去了.但由于最近项目要保证稳定,所以持续加班,没有时间写最后一点内容,本节也就简单截图做个说明,不详细叙述实现方式.我会把代码上传到最后一章中,有兴趣的 ...

  3. 【NOI 2014】 动物园

    [题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=3670 [算法] KMP [代码] #include<bits/stdc++.h ...

  4. 杂项:ASP.NET Web API

    ylbtech-杂项:ASP.NET Web API ASP.NET Web API 是一种框架,用于轻松构建可以访问多种客户端(包括浏览器和移动设备)的 HTTP 服务. ASP.NET Web A ...

  5. Nearest-Neighbor Methods(ESL读书笔记)

    Nearest-neighbor methods use those observations in the training set T closest in input space to x  f ...

  6. Flink之流处理理论基础

    目录 Introduction to Stateful Stream Processing Traditional Data Infrastructures Stateful Stream Proce ...

  7. git拉取远端改变,但是不覆盖本地的修改

    1.git stash 2.git  fetch weixin-old-remote 3.git rebase weixin-old-remote/main151028_wxpay_main15100 ...

  8. springboot创建项目

    Springboot作为轻量级快速开发受到无数java人的青睐,Spring Boot是为了简化Spring应用的创建.运行.调试.部署等而出现的,使用它可以做到专注于Spring应用的开发,而无需过 ...

  9. UILabel垂直方向显示(上下的顺序显示)。

    NSString* text = @"一"; NSDictionary *attribute = @{NSFontAttributeName: [UIFont systemFont ...

  10. Apache 虚拟主机 配置方法

    打开httpd.conf文件 去掉LoadModule vhost_alias_module modules/mod_vhost_alias.so前面的#号 去掉Include conf/extra/ ...