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 ...
随机推荐
- 高级算法设计讲义 Lecture Notes for Advanced Algorithm Design
(Last modification: 2012-12-17) Textbooks: (1) David Williamson, David Shmoys. The Design of Approxi ...
- JavaScript对列表节点的操作:删除指定节点、删除最后一个节点、删除第一个节点、删除所有节点、增加节点
使用菜鸟的运行环境直接测试:http://www.runoob.com/try/try.php?filename=tryjs_events <!DOCTYPE html> <html ...
- 在智能手机上跟踪ADS-B系统的飞机航线信息
飞机飞行的中断可能会给航空公司造成数十亿美员的损失,但即便如此大多数现代商业航班仍旧依赖于存有严重安全问题的空中交通管制系统.到2020年,这些系统将会被升级为一个被称之为NextGen的系统,该系统 ...
- selenium python (九)对话框处理
#!/usr/bin/python# -*- coding: utf-8 -*-__author__ = 'zuoanvip' from selenium import webdriver #对于对 ...
- yii使用CUploadedFile上传文件
一.前端代码 Html代码 <form action="<?php echo $this->createUrl('/upload/default/upload/');? ...
- TinyXML的使用
TinyXML TinyXML是一个简单的小型C ++ XML解析器,可以轻松集成到其他程序中. 它能做什么: 简而言之,TinyXML解析XML文档,并从可以读取,修改和保存的文档对象模型(DOM) ...
- JAVA WEB学习笔记(一):JDK的安装及环境变量的配置
一.JDK的安装. JDK可以在Oracle(甲骨文)的官网下载,连接地址:http://www.oracle.com/technetwork/java/javase/downloads/index- ...
- mysql的DUPLICATE KEY
经常遇到这样的情景,向一个表里插入一条数据,如果已经存在就更新一下,用程序实现麻烦而且在并发的时候可能会有问题,这时用mysql的DUPLICATE KEY 很方便 用法如下: INSERT INTO ...
- 获取Bootstrap-Table的所有内容,修改行内容
var allTableData = $tableLeft.bootstrapTable('getData');//获取表格的所有内容行 var flag = false; for( i=0;i< ...
- ViewGroup如何分发事件
dispatchTouchEvent事件派发显示隧道方式.再是冒泡方式隧道方式传递,直道某一个元素消耗此事件,由上至下逐层分发视图.冒泡方式传递,当某个视图消耗事件后其return boolean 是 ...
