HDU-5540 Secrete Master Plan
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)
Total Submission(s): 801 Accepted Submission(s): 470Problem DescriptionMaster 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 2×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.
InputThe first line of the input gives the number of test cases, T(1≤T≤104). T test cases follow. Each test case contains 4 lines. Each line contains two integers ai0 and ai1 (1≤ai0,ai1≤100). The first two lines stands for the original plan, the 3rd and 4th line stands for the plan Fei opened.OutputFor each test case, output one line containing "Case #x: y", where x is the test case number
(starting from 1) and y is either "POSSIBLE" or "IMPOSSIBLE" (quotes for clarity).Sample Input41 23 41 23 41 23 43 14 21 23 43 24 11 23 44 32 1Sample OutputCase #1: POSSIBLECase #2: POSSIBLECase #3: IMPOSSIBLECase #4: POSSIBLE
题意:
求所给矩阵能否经过旋转得到下一个矩阵。
就对比顺时针前后两元素是否相等即可。
附AC代码:
#include<bits/stdc++.h>
using namespace std; int main(){
int t;
cin>>t;
int ans=;
while(t--){
int a1,b1,c1,d1,a2,b2,c2,d2;
cin>>a1>>b1>>c1>>d1>>a2>>b2>>c2>>d2;
if(a2==a1&&b1==b2&&c1==c2){
cout<<"Case #"<<ans++<<": POSSIBLE"<<endl;
continue;
}
if(b2==a1&&a2==c1&&d2==b1){
cout<<"Case #"<<ans++<<": POSSIBLE"<<endl;
continue;
}
if(c2==a1&&d2==c1&&a2==b1){
cout<<"Case #"<<ans++<<": POSSIBLE"<<endl;
continue;
}
if(d2==a1&&c2==b1&&b2==c1){
cout<<"Case #"<<ans++<<": POSSIBLE"<<endl;
continue;
}
cout<<"Case #"<<ans++<<": IMPOSSIBLE"<<endl;
}
return ;
}
HDU-5540 Secrete Master Plan的更多相关文章
- hdu 5540 Secrete Master Plan(水)
Problem Description Master Mind KongMing gave Fei Zhang a secrete master plan stashed × matrix, but ...
- The 2015 China Collegiate Programming Contest A. Secrete Master Plan hdu5540
Secrete Master Plan Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Othe ...
- 2015南阳CCPC A - Secrete Master Plan 水题
D. Duff in Beach Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 无 Description Master Mind KongMing gave ...
- ACM Secrete Master Plan
Problem Description Master Mind KongMing gave Fei Zhang a secrete master plan stashed in a pocket. T ...
- 2015南阳CCPC A - Secrete Master Plan A.
D. Duff in Beach Description Master Mind KongMing gave Fei Zhang a secrete master plan stashed in a ...
- HDOJ5540 Secrete Master Plan
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5540 题目大意:给一个两个2*2的矩阵,第二个矩阵能不能通过旋转得到第一个矩阵 题目思路:模拟 #in ...
- ACM学习历程—UESTC 1215 Secrete Master Plan(矩阵旋转)(2015CCPC A)
题目链接:http://acm.uestc.edu.cn/#/problem/show/1215 题目大意就是问一个2*2的矩阵能否通过旋转得到另一个. 代码: #include <iostre ...
- hdu 2251 Dungeon Master bfs
Dungeon Master Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 17555 Accepted: 6835 D ...
- HDU 5016 Mart Master II
Mart Master II Time Limit: 6000ms Memory Limit: 65536KB This problem will be judged on HDU. Original ...
随机推荐
- Android PullToRefresh 下拉刷新,上拉很多其它,支持ScrollView,ListView,可方便拓展GridView,WebView等
在写着东西之前.从网上找到非常多这方面的源代码,可是基本没有找到惬意的.包含在GitHub上的比較有名的Android-PullToRefresh-master.思来想去还是自己写吧.当然当中借鉴了一 ...
- BUPT复试专题—二进制数(2012)
https://www.nowcoder.com/practice/103dd589fed14457a673c613d8de3841?tpId=67&tqId=29634&tPage= ...
- HTML网页之进入站点口令脚本
加入以下这个脚本在head标签中. <script language="JavaScript"> <!-- var password=""; ...
- 生活娱乐 ATM机键盘余温泄露密码
安全系统存漏洞 ATM机键盘余温或泄露密码 ATM机会泄露你的银行卡密码? 据美国<大众科学>网站8月30日报道,你的手指在ATM机上留下的余温能让尾随你而来的黑客准确获知你的密码. 加利 ...
- pomelo加入定时任务
需求:在arenaserver下添加一个rank定时任务,每一分钟对对玩家进行一次排行. 首先在game-server/app/servers/arena文件夹下添加cron文件夹. 在game-se ...
- candy——动态规划
There are N children standing in a line. Each child is assigned a rating value. You are giving candi ...
- SpringBoot学习之快速入门创建
maven构建项目 1.访问http://start.spring.io/,进入快速创建工程的主页 可参考下图所示: 2.选择构建工具Maven Project.Spring Boot版本1.3.6以 ...
- 【转载】.NET Remoting学习笔记(一)概念
目录 .NET Remoting学习笔记(一)概念 .NET Remoting学习笔记(二)激活方式 .NET Remoting学习笔记(三)信道 背景 自接触编程以来,一直听过这个名词Remotin ...
- unity视频播放,
PC端视频播放: Unity中实现PC端播放视频,非常easy用到MovieTexture属于贴图Texture的子类. 在播放视频之前.我们得记得下载quicktime插件,仅仅有导入了quickt ...
- Mysql整数运算NULL值处理注意点
CleverCode近期在导出报表的时候,在整数做减法的时候,发现整数减去null得到是null.这是一个细节问题,希望大家以后注意. 1 表中的数据 total,used都是整形,同意为空. 2 有 ...
