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. vue.js的一些模板指令简述

    1.模板指令都是写在<template></template>html里面   v-text : value是什么就显示什么,如果value里面有html的标签,也会直接显示出 ...

  2. oracle数据库之分组查询

    本章内容和大家分享的是数据当中的分组查询.分组查询复杂一点的是建立在多张表的查询的基础之上,(我们在上一节课的学习中已经给大家分享了多表查询的使用技巧,大家可以自行访问:多表查询1  多表查询2)而在 ...

  3. 国外物联网平台(8):Telit

    国外物联网平台(8) ——Telit 马智 定位 We Bring IoT to Life Telit提供世界上最全面的高性能物联网模块.连接服务和软件. 产品体系 模块 Telit提供丰富专业的物联 ...

  4. Log--检查各数据库日志的使用情况

    -- Recovery model, log reuse wait description, log file size,-- log usage size and compatibility lev ...

  5. C#多线程编程实战1.5检测线程状态

    using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threa ...

  6. c# 根据文件夹或文件名返回(文件夹或文件)的完整路径

    c#  根据文件夹或文件名返回(文件夹或文件)的完整路径 一.方案一:(使用windows API) 二.方案二:(扫描全盘)

  7. Ajax GET

    $ajax的post请求提交方式: Controller: @RequestMapping("/emps") @ResponseBody public Msg getEmps(@R ...

  8. Timer(定时器)

    默认情况下,在每个采样器之前没有任何延时,这样不能很好的模拟现实生活中人们访问网页,因为现实生活中人们点击一个请求后,会有一定的时间,然后再点击下一个请求,JMeter提供了定时器来模拟这种行为. 定 ...

  9. centos下安装memcached并设置开机自动启动-两种方法

    方法一: 安装memcachedyum install memcached 启动服务并初始化service memcached start -p 11211 -l 127.0.0.1 -d 设置mem ...

  10. (转)2-SAT小结

    2-sat小结 原文作者:老K 原文传送门 2-sat是什么 一类问题是这样的: (两个符号的意思 \(\lor \ or,\land \ and\)) 有n个布尔变量,现在对它们做出限制,比如\(a ...