D. Duff in Beach

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

题意

给你两个2*2的矩阵,判断一个旋转是否能得到另外一个

题解:

    模拟不多说

///
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll;
#define mem(a) memset(a,0,sizeof(a))
#define meminf(a) memset(a,127,sizeof(a))
#define TS printf("111111\n")
#define FOR(i,a,b) for( int i=a;i<=b;i++)
#define FORJ(i,a,b) for(int i=a;i>=b;i--)
#define READ(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define inf 100000
inline ll read()
{
ll x=,f=;
char ch=getchar();
while(ch<''||ch>'')
{
if(ch=='-')f=-;
ch=getchar();
}
while(ch>=''&&ch<='')
{
x=x*+ch-'';
ch=getchar();
}
return x*f;
}
//**************************************** int main()
{
int oo=;
int a[],b[];
int T=read();
while(T--){
for(int i=;i<=;i++){ scanf("%d",&b[i]); }
for(int i=;i<=;i++){ scanf("%d",&a[i]); }
bool flag=;
if(b[]==a[]&&b[]==a[]&&b[]==a[]&&b[]==a[]){
flag=;
}
if(a[]==b[]&&a[]==b[]&&a[]==b[]&&a[]==b[]){
flag=;
}
if(a[]==b[]&&a[]==b[]&&a[]==b[]&&a[]==b[]){flag=;}
if(a[]==b[]&&a[]==b[]&&a[]==b[]&&a[]==b[]){flag=;}
printf("Case #%d: ",oo++);
if(flag){
cout<<"POSSIBLE"<<endl;
}
else {
cout<<"IMPOSSIBLE"<<endl;
}
}
return ;
}

代码

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

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

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

  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. hdu 5540 Secrete Master Plan(水)

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

  4. ACM Secrete Master Plan

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

  5. HDU-5540 Secrete Master Plan

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

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

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

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

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

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

  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. dutacm.club_1089_A Water Problem_(dp)

    题意:要获得刚好后n个'k'的字符串,有两种操作,1.花费x秒,增加或删除1个'k'; 2.花费y秒,使个数翻倍.问最少需要多少时间获得这个字符串. 思路:i为偶数个'k',dp[i]=min(dp[ ...

  2. re模块,正则表达式

    re模块 作用:取文本或者字符串内你所需要的东西 正则表达式的大致匹配过程是:依次拿出表达式和文本中的字符比较,如果每一个字符都能匹配,则匹配成功:一旦有匹配不成功的字符则匹配失败. ^叫做元字符,元 ...

  3. SpringBoot中如何使用jpa和jpa的相关知识总结

    jpa常用的注解: 注解 解释 @Entity 声明类为实体或表. @Table 声明表名. @Basic 指定非约束明确的各个字段. @Embedded 指定类或它的值是一个可嵌入的类的实例的实体的 ...

  4. CAD控件:控件图形数据库概要说明

    1.1 控件数据库 3 1.1.1 数据库概述 3 1.2 数据库初始化 4 1.3 创建和组织数据库 4 1.4 保存数据库 4 1.5 插入一个数据库 4 1.6 设置当前数据库值 5 1.6.1 ...

  5. Spring框架系列(四)--IOC控制反转和DI依赖注入

    背景: 如果对象的引用或者依赖关系的管理由具体对象完成,代码的耦合性就会很高,代码测试也变得困难.而IOC可以很好的解决这个问题,把这 些依赖关系交给框架或者IOC容器进行管理,简化了开发. IOC是 ...

  6. 苹果和虫子问题C++

    如果需要转载,请注明出处:http://www.cnblogs.com/wongyi/p/8205305.html 最近在给小朋友补奥数课,顺便看了几道题目,觉得写出来会比较集中,整理一下哈哈哈. 问 ...

  7. docker 1-->docker machine 转载

    Docker Machine 是 Docker 官方编排(Orchestration)项目之一,负责在多种平台上快速安装 Docker 环境. Docker Machine 是一个工具,它允许你在虚拟 ...

  8. java面试题链接

    http://blog.csdn.net/jackfrued/article/details/17339393

  9. 深入分析同步工具类之AbstractQueuedSynchronizer

      概览: AQS(简称)依赖内部维护的一个FIFO(先进先出)队列,可以很好的实现阻塞.同步:volatile修饰的属性state,哪个线程先改变这个状态值,那么这个线程就获得了优先权,可以做任何事 ...

  10. ssh中将常用的命令做别名

    1.vim ~/.bashrc 将光标落到user下面 2. 输入 alias x=‘ssh的命令’ 3.按ESC键,退出输入状态: 4.按:,然后输入wq,保存退出: 5. source ~/.ba ...