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的更多相关文章

  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 (13.08.06)

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

  5. UVa 253 Cube paiting

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

  6. UVa 253 骰子涂色

    https://vjudge.net/problem/UVA-253 题意:输入两个骰子的六面颜色,判断是否等价. 思路:我最想到的是暴力,不过一直错,也不知道哪里错了.第二种方法就是在一个骰子里出现 ...

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

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

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

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

  9. uva253 Cube painting(UVA - 253)

    题目大意 输入有三种颜色判断两个骰子是否相同 思路(借鉴) ①先用string输入那12个字符,然后for出两个骰子各自的字符串 ②这里用的算法是先找出第一个的三个面与第二个的六个面去比较,如果找到相 ...

随机推荐

  1. 35.MID() 函数

    MID() 函数 MID() 函数 MID 函数用于从文本字段中提取字符. SQL MID() 语法 SELECT MID(column_name,start[,length]) FROM table ...

  2. asp.net web 自定义控件

    0.调用代码 protected override void Page_Load(object sender, EventArgs e) { //给基类服务接口复制,可不付 if (IsPostBac ...

  3. On the nightmare that is JSON Dates. Plus, JSON.NET and ASP.NET Web API

    Ints are easy. Strings are mostly easy. Dates? A nightmare. They always will be. There's different c ...

  4. datetime 2017-10-21 10:09:02.560 转年月日的时间类型

    sql语句时间转年月日格式: 适用于多种时间格式 select  REPLACE(STUFF(CONVERT(char(10), REPLACE(CONVERT(varchar(10),'2017-1 ...

  5. 很棒的bootstrap学习网站

    http://www.w3cschool.cc/bootstrap/bootstrap-tutorial.html

  6. SxsTrace使用的方法

    Windows7平台上有一个强大的SxsTrace工具,可以跟踪调试应用程序运行时需要的动态库的版本和路径.   SxsTrace使用的方法:   1.首先必须以Administrator用户身份登录 ...

  7. Ubuntu配置ip和dns后还是不能访问外网

    https://blog.csdn.net/WFping518/article/details/81011722

  8. vue生态圈

    本文来自网易云社区 作者:刘凌阳 前言 公司社区上关于Vue的文章挺少的(少的可怜),不禁为Vue愤愤不平,此文应运而生. 但笔者水平有限,也写不了什么特别高深的东西,只能简单介绍下Vue生态圈,如有 ...

  9. List_Delete

    /*Sorting from little to large use List*/ #include <stdio.h> /* printf, scanf, NULL */ #includ ...

  10. spring boot 第一个Dome

    1.创建Maven项目 按照下面的步骤 项目创建完成后的目录结构 2. 参照Spring boot官方文档修改pom.xml 修改 maven编译的jdk版本 将spring boot设置为 pare ...