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 ...
随机推荐
- http转成https
1.在阿里云服务器上购买一个AC证书,将证书下载下来 2.解压放在tomcat目录下,cert文件夹是我自己建的 3.修改tomcat的配置文件上面那个原来是被注掉的放开 把端口改为443,htt ...
- 应用程序中的server错误,没有名称为“ServiceBehavior”的服务行为
应用程序中的server错误,没有名称为"ServiceBehavior"的服务行为 今天在阅读"创建和使用Web服务"的相关内容,在浏览器中查 ...
- BUPT复试专题—哈夫曼树(2010)
https://www.nowcoder.com/practice/162753046d5f47c7aac01a5b2fcda155?tpId=67&tqId=29635&tPage= ...
- add swapspace file on ubuntu.
https://askubuntu.com/questions/566745/allocate-swap-after-ubuntu-14-04-lts-installation ----------- ...
- MySQL之常见问题总结
MySQL总是崩溃 首先你应该试着找出问题MySQLd守护进程是否死掉或你的问题是否与你的客户有关.你能够用MySQLadmin version检查你的MySQLdserver正常运行了多长时间.假设 ...
- 一篇很好的讲解SIFT算法的文章
http://blog.csdn.net/zddblog/article/details/7521424
- vue 计算属性与侦听器
侦听器:顾名思义,就是用来监听数据变化用的.侦听器在vue实例中,定义变量watch来使用.监听新值newVal和旧值oldVal,具体使用方法如下: <!DOCTYPE html> &l ...
- spring 相关博客
Spring中使用Interceptor拦截器 spirng4 中文文档 ssm整合 Spring系列之Spring常用注解总结 Spring框架中context-param与servlet中in ...
- antV G6流程图在Vue中的使用
最近我司项目中需要加入流程图制作功能,于是乎百度各种找可视化绘制拓扑图的轮子,大部分都是国外的,看文档太吃力,不过好在最终让我发现了AntV G6流程图图表库,最新版为2.0,不过编辑器在2.0版本还 ...
- noi2014魔法森林
为了得到书法大家的真传,小 E 同学下定决心去拜访住在魔法森林中的隐 士.魔法森林可以被看成一个包含