D. Duff in Beach

Time Limit: 1 Sec

Memory Limit: 256 MB

题目连接

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 a 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

HINT

题意

给你俩2*2的矩阵,问你能不能通过旋转从第一个得到第二个

题解:

暴力转圈圈就好了

代码:

#include<iostream>
#include<stdio.h>
using namespace std; int a[][];
int b[][];
int c[][];
int check()
{
if(a[][]==b[][]&&a[][]==b[][]&&a[][]==b[][]&&a[][]==b[][])
return ;
if(a[][]==b[][]&&a[][]==b[][]&&a[][]==b[][]&&a[][]==b[][])
return ;
if(a[][]==b[][]&&a[][]==b[][]&&a[][]==b[][]&&a[][]==b[][])
return ;
if(a[][]==b[][]&&a[][]==b[][]&&a[][]==b[][]&&a[][]==b[][])
return ;
return ;
}
int main()
{
int t;scanf("%d",&t);
for(int cas = ;cas <= t;cas++)
{
for(int i=;i<=;i++)
for(int j=;j<=;j++)
scanf("%d",&a[i][j]);
for(int i=;i<=;i++)
for(int j=;j<=;j++)
scanf("%d",&b[i][j]);
if(check())
printf("Case #%d: POSSIBLE\n",cas);
else
printf("Case #%d: IMPOSSIBLE\n",cas);
}
}

2015南阳CCPC A - Secrete Master Plan 水题的更多相关文章

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

  2. 2015南阳CCPC L - Huatuo's Medicine 水题

    L - Huatuo's Medicine Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 无 Description Huatuo was a famous ...

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

  4. hdu 5540 Secrete Master Plan(水)

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

  5. ACM Secrete Master Plan

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

  6. HDU-5540 Secrete Master Plan

    Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission( ...

  7. 2015南阳CCPC E - Ba Gua Zhen 高斯消元 xor最大

    Ba Gua Zhen Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 无 Description During the Three-Kingdom perio ...

  8. 2015南阳CCPC F - The Battle of Guandu 多源多汇最短路

    The Battle of Guandu Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 无 Description In the year of 200, t ...

  9. 2015南阳CCPC H - Sudoku 暴力

    H - Sudoku Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 无 Description Yi Sima was one of the best cou ...

随机推荐

  1. 【转】This version of the rendering library is more recent than your version of ADT plug-in. Please update ADT plug-in

    原文网址:http://1982106a.blog.163.com/blog/static/8436495620149239361692/ 预览layout.xml文件时提示: This versio ...

  2. PHP 获取远程文件的大小的3种方法

    1.使用file_get_contents() <?php $file = file_get_contents($url); echo strlen($file); ?> 2. 使用get ...

  3. 为移动Web应用创建快速响应按钮

    英文原文出自 Google Deveploers<Creating Fast Buttons for Mobile Web Applications>,由XiaoYi_HD翻译,并首发于 ...

  4. 从python的yield说起

    前段时间在读trac 中wiki模块的源码的时候,发现了很多地方都使用了yiled这一关键词, 感觉是在需要返回某个值的地方通过yield来代替return, 不是很明白其用法,所以仔细研究下. 一个 ...

  5. iOS开发相关图书推荐

    Objective-C编程之道:iOS设计模式解析 作      者 [美] Carlo Chung 著:刘威 译 出 版 社 人民邮电出版社 出版时间 2011-11-01 版      次 1 页 ...

  6. 把JSON数据载入到页面表单的两种思路(对easyui自带方法进行改进)

    #把JSON数据载入到页面表单的两种思路(对easyui自带方法进行改进) ##背景 项目中经常需要把JSON数据填充到页面表单,一开始我使用easyui自带的form load方法,觉得效率很低,经 ...

  7. Chapter 1 初探Caffe

    首先下载windows下源码: Microsoft 官方:GitHub - Microsoft/caffe: Caffe on both Linux and Windows 官方源码使用Visual ...

  8. AspNetPager 的使用

    下面选用的是新闻发布系统里用的代码. SQL 存储过程: CREATE PROCEDURE procNewsSelectByPager @startRecordIndex int, @endRecor ...

  9. 【转】Maven实战(七)---传递依赖

    原博文出自于:http://blog.csdn.net/liutengteng130/article/details/47000069   感谢! 假设A-->C  B-->A      ...

  10. Gym 100818I Olympic Parade(位运算)

    Olympic Parade http://acm.hust.edu.cn/vjudge/contest/view.action?cid=101594#problem/I [题意]: 给出N个数,找出 ...