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. aspx与ascx,ashx的用法详细的总结介绍

    这篇文章主要是对aspx与ascx,ashx的用法进行了详细的总结介绍,需要的朋友可以过来参考下,希望对大家有所帮助 做asp.net开发的对.aspx,.ascx和.ashx都不会陌生.关于它们,网 ...

  2. trie树 Codeforces Round #367 D Vasiliy's Multiset

    // trie树 Codeforces Round #367 D Vasiliy's Multiset // 题意:给一个集合,初始有0,+表示添加元素,-去除元素,?询问集合里面与x异或最大的值 / ...

  3. Hadoop-安装过程-单虚拟机版(伪分布式)(Ubuntu13.04版本下安装)

    由于新装的Ubutu默认情况下,系统只安装了SSH客户端,需要自行安装SSH服务端 如何确定是否安装了SSH服务端? 可以通过命令ssh localhost,结果如下,即未安装SSH服务端:   安装 ...

  4. 在fedora20下面手动为自己的安装程序创建桌面图标

    (博客园-番茄酱原创) 在/usr/share/applications/下面创建destktop文件,用于产生桌面图标 创建文件:touch android-eclipse.desktop 编辑文件 ...

  5. Oracle Database 12c 新特性 - Pluggable Database

    在Oracle Database 12c中,可组装式数据库 - Pluggable Database为云计算而生.在12c以前,Oracle数据库是通过Schema来进行用户模式隔离的,现在,可组装式 ...

  6. java动态代理与老式AOP实现

    JAVA的动态代理 代理模式是常用的java设计模式,他的特征是代理类与委托类有同样的接口,代理类主要负责为委托类预处理消息.过滤消息.把消息转发给委托类,以及事后处理消息等.代理类与委托类之间通常会 ...

  7. HDU 5805 NanoApe Loves Sequence (模拟)

    NanoApe Loves Sequence 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5805 Description NanoApe, the ...

  8. HDU 5833 Zhu and 772002 (高斯消元)

    Zhu and 772002 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5833 Description Zhu and 772002 are b ...

  9. codeforces 629A Far Relative’s Birthday Cake

    A. Far Relative’s Birthday Cake time limit per test 1 second memory limit per test 256 megabytes inp ...

  10. UVa 10817 Headmaster's Headache (状压DP+记忆化搜索)

    题意:一共有s(s ≤ 8)门课程,有m个在职教师,n个求职教师.每个教师有各自的工资要求,还有他能教授的课程,可以是一门或者多门. 要求在职教师不能辞退,问如何录用应聘者,才能使得每门课只少有两个老 ...