UESTC 1215 (思维题 旋转)
Secrete Master Plan
Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others)
Master Mind KongMing gave Fei Zhang a secrete master plan stashed in a pocket. The plan instructs how to deploy soldiers on the four corners of the city wall. Unfortunately, when Fei opened the pocket he found there are only four numbers written in dots on a piece of sheet. The numbers form a 2×22×2 matrix, but Fei didn't know the correct direction to hold the sheet. What a pity!
Given two secrete master plans. The first one is the master's original plan. The second one is the plan opened by Fei. As KongMing had many pockets to hand out, he might give Fei the wrong pocket. Determine if Fei receives the right pocket.
Input
The first line of the input gives the number of test cases, TT(1≤T≤1041≤T≤104). TT test cases follow. Each test case contains 44 lines. Each line contains two integers ai0ai0 and ai1ai1 (1≤ai0,ai1≤1001≤ai0,ai1≤100). The first two lines stands for the original plan, the 3rd3rd and 4th4th line stands for the plan Fei opened.
Output
For each test case, output one line containing Case #x: y
, where xx is the test case number (starting from 11) and yy is either "POSSIBLE
" or "IMPOSSIBLE
" (quotes for clarity).
Sample input and output
Sample Input | Sample Output |
---|---|
|
|
Source
- #include <iostream>
- using namespace std;
- int main()
- {
- int t,a,b,c,d,x,y,z,w,tmp,k=;
- cin>>t;
- while(t--)
- {
- int flag=;
- cin>>a>>b>>d>>c;
- cin>>x>>y>>w>>z;
- while (a!=x||b!=y||d!=w||c!=z)
- {
- tmp=a;
- a=b;
- b=c;
- c=d;
- d=tmp;
- flag++;
- if (flag==)
- break;
- }
- if (flag<)
- {
- cout<<"Case #"<<k++<<": POSSIBLE"<<endl;
- }
- else
- cout<<"Case #"<<k++<<": IMPOSSIBLE"<<endl;
- }
- return ;
- }
UESTC 1215 (思维题 旋转)的更多相关文章
- 洛谷 P4749 - [CERC2017]Kitchen Knobs(差分转换+dp,思维题)
题面传送门 一道挺有意思的思维题. 首先有一个 obvious 的结论,就是对于每个炉子,要么转到哪里都符合条件,要么存在唯一的最大值.对于转到哪儿都符合条件的炉子我们 duck 不必考虑它,故我们只 ...
- zoj 3778 Talented Chef(思维题)
题目 题意:一个人可以在一分钟同时进行m道菜的一个步骤,共有n道菜,每道菜各有xi个步骤,求做完的最短时间. 思路:一道很水的思维题, 根本不需要去 考虑模拟过程 以及先做那道菜(比赛的时候就是这么考 ...
- cf A. Inna and Pink Pony(思维题)
题目:http://codeforces.com/contest/374/problem/A 题意:求到达边界的最小步数.. 刚开始以为是 bfs,不过数据10^6太大了,肯定不是... 一个思维题, ...
- ZOJ 3829 贪心 思维题
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3829 现场做这道题的时候,感觉是思维题.自己智商不够.不敢搞,想着队友智商 ...
- 洛谷P4643 [国家集训队]阿狸和桃子的游戏(思维题+贪心)
思维题,好题 把每条边的边权平分到这条边的两个顶点上,之后就是个sb贪心了 正确性证明: 如果一条边的两个顶点被一个人选了,一整条边的贡献就凑齐了 如果分别被两个人选了,一作差就抵消了,相当于谁都没有 ...
- C. Nice Garland Codeforces Round #535 (Div. 3) 思维题
C. Nice Garland time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...
- PJ考试可能会用到的数学思维题选讲-自学教程-自学笔记
PJ考试可能会用到的数学思维题选讲 by Pleiades_Antares 是学弟学妹的讲义--然后一部分题目是我弄的一部分来源于洛谷用户@ 普及组的一些数学思维题,所以可能有点菜咯别怪我 OI中的数 ...
- UVA 1394 And Then There Was One / Gym 101415A And Then There Was One / UVAlive 3882 And Then There Was One / POJ 3517 And Then There Was One / Aizu 1275 And Then There Was One (动态规划,思维题)
UVA 1394 And Then There Was One / Gym 101415A And Then There Was One / UVAlive 3882 And Then There W ...
- HDU 1029 Ignatius and the Princess IV / HYSBZ(BZOJ) 2456 mode(思维题,~~排序?~~)
HDU 1029 Ignatius and the Princess IV (思维题,排序?) Description "OK, you are not too bad, em... But ...
随机推荐
- Python input()和raw_input()的区别
当输入为数字的时候,input()获得的是数字,而后者获得的是str,可以用int(raw_input())来转换. i = input() print i+1 j = raw_input() pri ...
- java中获取路径中的空格处理(%20)问题
在java中获取文件路径的时候,有时候会获取到空格,但是在中文编码环境下,空格会变成“%20”从而使得路径错误. 解决办法: String path = Parameter.class.getReso ...
- python学习笔记之module && package
个人总结: import module,module就是文件名,导入那个python文件 import package,package就是一个文件夹,导入的文件夹下有一个__init__.py的文件, ...
- Apache22中配置虚拟主机(Apache VirtualHost)
Apache VirtualHost的作用就是可以让一个apache为多个域名服务,相当于一个服务器挂了N多个网站,举个例子: 我的apache服务器,ip为x.x.x.x,我有两个域名www.too ...
- myBatis 实现用户表增操作(复杂型)
增加 @Test public void addTest(){ String resource = "mybatis-config.xml"; SqlSession sqlSess ...
- 【转】linux expr命令参数及用法详解
在抓包过程中,查看某个设定时间内,数据上下行多少,用命令expr 计算! --------------------------------------------------------------- ...
- metinfo首页内容简介
http://www.hlbaozhuangji.cn/manage/content/other_info.php?anyid=31&lang=cn 首页内容简介: select * from ...
- 错误 X “X1”不包含“XX2”的定义,并且找不到可接受类型为“X1”的第一个参数的扩展方法“XX2”(是否缺少 using 指令或程序集引用?)
由于我是复制其他.cs文件的代码··· 出错了·搜了一下解决方法··· 但是不适用···· 个人出错原因: 忘了在.cs文件的刚开始(即:using xx:后) namespace aaa.bb { ...
- WhatsApp值160亿美元,腾讯推大众点评微信支付!
腾讯前脚刚入股大众点评,FB后脚就将斥资160亿美元收购WhatsApp(40亿美元现金和120亿美元股票). 为什么WhatsApp值160亿美元?这是什么东东呢?WhatsApp这款服务可以帮助用 ...
- MBProgressHUD使用
//方式1.直接在View上show HUD = [[MBProgressHUD showHUDAddedTo:self.view animated:YES] retain]; HUD.delegat ...