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 |
---|---|
4 |
Case #1: POSSIBLE |
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 ...
随机推荐
- BZOJ1046 [HAOI2007]上升序列
Description 对于一个给定的S={a1,a2,a3,…,an},若有P={ax1,ax2,ax3,…,axm},满足(x1 < x2 < … < xm)且( ax1 < ...
- [IOS+PHP Jason格式的发送与解析]
服务器端PHP文件connect.php: <?php $q = mysql_connect("localhost","root","" ...
- 【Beta阶段】发布说明
在经历Beta阶段紧张的开发后,本次Beta阶段取得的成果虽然不如Alpha阶段多,但是也算是做到了稳中求进,一共预想了三个feature,最终做出了预想的两个feature. 新功能说明 新的主页: ...
- jquery------显示加载的js时出现中文乱码解决方法
方法: 把my.js文件复制出来,用记事本打开,再另存为的时候设置编码格式为utf-8即可
- 打印多边形的菱形(for的嵌套)
Console.WriteLine("请输入一个数字,会出现一个多边的菱形:"); int n = Convert.ToInt32(Console.ReadLine()); ; i ...
- yum被锁Another app is currently holding the yum lock; waiting for it to exit...
可能是系统自动升级正在运行,yum在锁定状态中. 可以通过强制关掉yum进程: #rm -f /var/run/yum.pid 然后就可以使用yum了.
- 织梦DedeCms网站更换域名后文章图片路径批量修改
因为织梦上传图片用的是绝对地址,如果域名更换后,之前发布的文章的图片URL是不会跟着改变的,所以我们需要把旧域名替换成新的域名,方法很简单,有一段SQL语句更新一下文章正文内容就行. 复制下面SQL语 ...
- zabbix: failed to accept an incoming connection
错误描述 查日志发现: failed to accept an incoming connection: connection from "192.168.186.132" rej ...
- java开发微信公众平台备忘
简单记录下前段时间开发的电子书的 公众平台的一些备忘及开发心得经验等 eclipse的一些技巧: 1.ctrl+shift+o 自动添加必要import空间及移除无用import 项目备忘+说明 1. ...
- 微信稳居Android App排行榜4月份国内榜首
根据某机构通过对Android样本访问行为的持续监测数据进行样本属性加权并根据iOS/Android用户调研数据建模推总得出中国移动互联网用户规模以及相应的用户结构数据显示,2015年4月份国内And ...