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. Mybatis学习——基本增删改查(CRUD)

    Eclipse+Mybatis+MySql 1.所需jar 2.项目目录 3.源代码 package com.zhengbin.entity; public class Student { priva ...

  2. Github 终于开始认真考虑开源项目许可证了

    如今GitHub已成为全球最流行的开源项目托管平台,但也有质疑声音——“Github中的大多数项目并不算是开源项目”.这是因为Github中大多数项目并没有明确声明所使用的许可证. 根据版权法规定,如 ...

  3. redis错误汇总

    1.redis因为内存不够而启动失败 Microsoft Open Tech group 在 GitHub上开发了一个REDIS Win64的版本,项目地址是:https://github.com/M ...

  4. 【剑指offer 面试题21】包含min函数的栈

    思路: 通过增加一个辅助栈保存每个状态对应的最小值.栈实现的不完整,应该还包含empty()等常规函数. #include <iostream> #include <stack> ...

  5. linux常用命令之--目录与文件的操作命令

    1.linux的目录与文件的增.删.改.复制 pwd:用于显示当前所在的目录 ls:用于显示指定目录下的内容 其命令格式如下: ls [-option] [file] 常用参数: -l:显示文件和目录 ...

  6. 【ActiveX】实现安全接口

    转自:http://www.cnblogs.com/carekee/articles/1772201.html 感谢原作者! ActiveX控件打包成cab后,在脚本中调用中时,要保证控件的安全性才能 ...

  7. ORA-15177: cannot operate on system aliases (DBD ERROR: OCIStmtExecute)

    ASM操作的时候,删除一个文件夹,删除不了,报错如下: ASMCMD> ls -l Type Redund Striped Time Sys Name Y IPAP/ ASMCMD> rm ...

  8. ArcMap10.1修改要素属性字段

    ArcMap10.1修改要素属性字段 问题描述:在ArcMap10.1中编辑要素属性表时,遇到输入字段值的长度超过字段最大长度时,ArcMap会抛出“基础DBMS错误[ORA-12899:value ...

  9. Java IO流中的File类学习总结

    一.File类概述 File类位于java.io包中,是对文件系统中文件以及文件夹进行封装的对象,可以通过对象的思想来操作文件和文件夹. File类有多种重载的构造方法.File类保存文件或目录的各种 ...

  10. linux 下载软件

    wget 软件地址 eg: 下载tomcat : wget http://apache.fayea.com/apache-mirror/tomcat/tomcat-7/v7.0.52/bin/apac ...