UVa 253
UVa 253


#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <cmath>
#include <sstream>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <iomanip>
#include <stack> using namespace std; typedef long long LL;
const int INF = 0x3f3f3f3f;
const int MAXN = ;
const int MOD = 1e9 + ; #define MemI(x) memset(x, -1, sizeof(x))
#define Mem0(x) memset(x, 0, sizeof(x))
#define MemM(x) memset(x, 0x3f, sizeof(x)) //把骰子的每一个面都放在第一面,有 6 种可能,然后第一面不变,中间四个面旋转
int dis[][] = {{, , , , , }, {, , , , , }, {, , , , , }, {, , , , , }, {, , , , , }, {, , , , , }};
int main()
{
string s;
while(cin >> s)
{
string a, b;
int i, j;
for(i = ;i < ;++i)
a += s[i];
for(i = ;i < ;++i)
b += s[i];
a[] = b[] = ;//分开两种面的情况
int flag = ;
for(i = ;i < && !flag;++i)
{
string t;
for(j = ;j < ;++j)
t += a[dis[i][j]];
t[] = ;
if(t == b)
flag = ;
//旋转中间四个面,可以发现 1 面是从 3 面转来的 (编号从 0 开始),以此类推
for(j = ;j < && !flag;++j)
{
char p = t[];
t[] = t[];
t[] = t[];
t[] = t[];
t[] = p;
if(t == b)
flag = ;
}
}
if(flag)
cout << "TRUE" << endl;
else
cout << "FALSE" << endl;
}
return ;
}
UVa 253的更多相关文章
- UVA 253 Cube painting(暴力打表)
Cube painting Problem Description: We have a machine for painting cubes. It is supplied with three d ...
- uva 253 - Cube painting(相同骰子)
习题4-4 骰子涂色(Cube painting, UVa 253) 输入两个骰子,判断二者是否等价.每个骰子用6个字母表示,如图4-7所示. 图4-7 骰子涂色 例如rbgggr和rggbgr分别表 ...
- UVA 253 Cube painting
大致题意:有三种颜色,一个立方体6面都可以涂一种颜色.现在给出两个每个面都涂好颜色的立方体,判断这两个立方体通过旋转是否相等. 立方体的旋转出来的结果有很多,首先可以0,1,2,3,4,5(顺序是:上 ...
- UVA 253 (13.08.06)
Cube painting We have a machine for painting cubes. It is supplied withthree different colors: blu ...
- UVa 253 Cube paiting
题意:输入两个骰子,判断是否等价 因为每一个面可以作顶面,共6*4种情况,枚举就可以了 #include<iostream> #include<cstdio> #include ...
- UVa 253 骰子涂色
https://vjudge.net/problem/UVA-253 题意:输入两个骰子的六面颜色,判断是否等价. 思路:我最想到的是暴力,不过一直错,也不知道哪里错了.第二种方法就是在一个骰子里出现 ...
- 骰子涂色 (Cube painting,UVa 253)
题目描述:算法竞赛入门习题4-4 题目思路:1.旋转其中一个骰子进行匹配 2.进行遍历,如果匹配,就进行相对面的匹配 3.三个对立面都匹配即是一样等价的 //没有按照原题的输入输出 #include ...
- UVA 253 Cube painting(枚举 模拟)
题意: 按如图的顺序给定2个骰子的颜色(只有r.b.g三种颜色) 问2个骰子是否一模一样 如 可表示为“rbgggr” 和 “rggbgr”, 第二个就是绕着Z轴顺时针旋转90度与第一个相同的骰子. ...
- uva253 Cube painting(UVA - 253)
题目大意 输入有三种颜色判断两个骰子是否相同 思路(借鉴) ①先用string输入那12个字符,然后for出两个骰子各自的字符串 ②这里用的算法是先找出第一个的三个面与第二个的六个面去比较,如果找到相 ...
随机推荐
- Celery笔记
异步任务神器 Celery 简明笔记 2016/12/19 · 工具与框架 · Celery, 异步 原文出处: FunHacks 在程序的运行过程中,我们经常会碰到一些耗时耗资源的操作,为了避 ...
- js日期 操作
//重写toString方法,将时间转换为Y-m-d H:i:s格式 Date.prototype.toString = function(){ ) + "-" + this.ge ...
- js打开所在文件夹并选中文件
该方法只支持IE. var wsh = new ActiveXObject("WSCript.shell"); var src = "/select," + ...
- Python基础入门-数据类型
一.变量 1)变量定义 在python中,我们可以把变量理解为一个值,变量是一个标签名,变量是有对应的一个值. name = 100(name是变量名 = 号是赋值号100是变量的值) 2)变量赋值 ...
- word 2013如何从某一页开始插入页码
把光标移入要插入页面的最前面 插入分页符 在要插入页码的页脚双击打开页脚设计 取消页脚和前面页眉的链接 插入页码
- POJ - 2965 The Pilots Brothers' refrigerator(压位+bfs)
The game “The Pilots Brothers: following the stripy elephant” has a quest where a player needs to op ...
- .net 3.5 Lambda表达式
Lambda表达式 转自http://www.cnblogs.com/kingmoon/archive/2011/05/03/2035696.html "Lambda表达式"是一个 ...
- .netcore项目部署IIS问题
1.一般根据项目安装对应的runtime 下载地址:https://www.microsoft.com/net/download 2.如果出现502错误可以在cmd命令里面运行如下 如果报错,找到对 ...
- docker run hello-world失败
提示镜像拉取失败,解决方案 到 https://cr.console.aliyun.com/ 注册一个账户 列表中就有 加速器 启动 Docker 端 右键 选择配置 在Docker Dae ...
- [转]解读Unity中的CG编写Shader系列3——表面剔除与剪裁模式
在上一个例子中,我们得到了由mesh组件传递的信息经过数学转换至合适的颜色区间以颜色的形式着色到物体上.这篇文章将要在此基础上研究片段的擦除(discarding fragments)和前面剪裁.后面 ...