Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)
Total Submission(s): 801    Accepted Submission(s): 470

Problem Description
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 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.

 
Input
The 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.
 
Output
For 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 Input
4
1 2
3 4
1 2
3 4
 
1 2
3 4
3 1
4 2
 
1 2
3 4
3 2
4 1
 
1 2
3 4
4 3
2 1
 
Sample Output
Case #1: POSSIBLE
Case #2: POSSIBLE
Case #3: IMPOSSIBLE
Case #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的更多相关文章

  1. hdu 5540 Secrete Master Plan(水)

    Problem Description Master Mind KongMing gave Fei Zhang a secrete master plan stashed × matrix, but ...

  2. 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 ...

  3. 2015南阳CCPC A - Secrete Master Plan 水题

    D. Duff in Beach Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 无 Description Master Mind KongMing gave ...

  4. ACM Secrete Master Plan

    Problem Description Master Mind KongMing gave Fei Zhang a secrete master plan stashed in a pocket. T ...

  5. 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 ...

  6. HDOJ5540 Secrete Master Plan

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5540 题目大意:给一个两个2*2的矩阵,第二个矩阵能不能通过旋转得到第一个矩阵 题目思路:模拟 #in ...

  7. ACM学习历程—UESTC 1215 Secrete Master Plan(矩阵旋转)(2015CCPC A)

    题目链接:http://acm.uestc.edu.cn/#/problem/show/1215 题目大意就是问一个2*2的矩阵能否通过旋转得到另一个. 代码: #include <iostre ...

  8. hdu 2251 Dungeon Master bfs

    Dungeon Master Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 17555   Accepted: 6835 D ...

  9. HDU 5016 Mart Master II

    Mart Master II Time Limit: 6000ms Memory Limit: 65536KB This problem will be judged on HDU. Original ...

随机推荐

  1. android 子菜单

    <!-- 定义基础布局LinearLayout --> <LinearLayout xmlns:android="http://schemas.android.com/ap ...

  2. nexus批量更新jar包

    nexus批量更新jar包 学习了:https://blog.csdn.net/newtelcom/article/details/54379607 手动进行jar包的拷贝,在维护界面内进行批量更新:

  3. [HTML5] Show Images of Differing Resolutions Depending on the Viewport Width with srcset

    For small viewports, we want to save bandwidth and we may be dealing with slow speeds; so it's very ...

  4. iOS --- 总结Objective-C中经常使用的宏定义(持续更新中)

    将iOS开发中经常使用的宏定义整理例如以下,仅包括Objective-C. 而对于Swift,不能使用宏,则能够定义全局函数或者extension.请參考博客iOS - 总结Swift中经常使用的全局 ...

  5. UP board 漫谈——从Atom到UP Board

    前言 原创文章,转载引用务必注明链接.如有疏漏,欢迎指正. 图文部分引用自CNXSoft ​ 每块开发板都有其设计理念,也是其特色所在.有做工优良.接口丰富的多媒体全能开发板Lemaker Guita ...

  6. row and col

    1.行 <Row gutter={{ md: 6, lg: 12, xl: 12 }}></Row> gutter: md: 中等屏幕 桌面显示器 (≥992px) lg: 大 ...

  7. window.onresize 事件笔记

     1.浏览器尺寸变化响应事件 : window.onresize = function(){....} 这里须要注意的是,onresize响应事件处理中.获取到的页面尺寸參数是变更后的參数. // ...

  8. RPM安装mysql5.6

    原文 http://blog.csdn.net/liumm0000/article/details/18841197 a. 检查MySQL及相关RPM包,是否安装,如果有安装,则移除(rpm –e 名 ...

  9. 手机号码归属地查询免费api接口代码

    依据手机号码查询用户的卡类型.运营商.归属地.区域等信息. 手机归属地实体类 package org.wx.xhelper.model; /** * 手机归属地 * @author wangxw * ...

  10. Variable 'bop' is uninitialized when captured by block

    代码: - (void)doTest { NSBlockOperation * bop = [NSBlockOperation blockOperationWithBlock:^{ if (!bop. ...