Secrete Master Plan

Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)
Total Submission(s): 429    Accepted Submission(s): 244

Problem 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 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 ai0and 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
 
Source
 
题意:问一个矩阵旋转之后是否与另一个矩阵相等。
分析:暴力。
 #include <cstdio>
#include <iostream>
using namespace std; const int N = ;
int A[][], B[][], T[][]; int main()
{
int test;
scanf("%d", &test);
for(int testnumber = ; testnumber <= test; testnumber++)
{
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]); bool flag = ;
for(int k = ; k < ; k++)
{
T[][] = B[][];
T[][] = B[][];
T[][] = B[][];
T[][] = B[][]; for(int i = ; i < ; i++)
for(int j = ; j < ; j++)
B[i][j] = T[i][j]; /*for(int i = 0; i < 2; i++)
{
for(int j = 0; j < 2; j++)
printf("%d ", B[i][j]);
printf("\n");
}*/ bool okay = ;
for(int i = ; i < && !okay; i++)
for(int j = ; j < ; j++)
if(A[i][j] != B[i][j])
{
okay = ;
break;
}
if(!okay)
{
flag = ;
break;
}
}
if(!flag) printf("Case #%d: POSSIBLE\n", testnumber);
else printf("Case #%d: IMPOSSIBLE\n", testnumber);
}
return ;
}

The 2015 China Collegiate Programming Contest A. Secrete Master Plan hdu5540的更多相关文章

  1. The 2015 China Collegiate Programming Contest Game Rooms

    Game Rooms Time Limit: 4000/4000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others) Submi ...

  2. The 2015 China Collegiate Programming Contest C. The Battle of Chibi hdu 5542

    The Battle of Chibi Time Limit: 6000/4000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Othe ...

  3. The 2015 China Collegiate Programming Contest L. Huatuo's Medicine hdu 5551

    Huatuo's Medicine Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others ...

  4. The 2015 China Collegiate Programming Contest K Game Rooms hdu 5550

    Game Rooms Time Limit: 4000/4000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total ...

  5. The 2015 China Collegiate Programming Contest H. Sudoku hdu 5547

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

  6. The 2015 China Collegiate Programming Contest G. Ancient Go hdu 5546

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

  7. The 2015 China Collegiate Programming Contest E. Ba Gua Zhen hdu 5544

    Ba Gua Zhen Time Limit: 6000/4000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total ...

  8. The 2015 China Collegiate Programming Contest D.Pick The Sticks hdu 5543

    Pick The Sticks Time Limit: 15000/10000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others ...

  9. The 2015 China Collegiate Programming Contest -ccpc-c题-The Battle of Chibi(hdu5542)(树状数组,离散化)

    当时比赛时超时了,那时没学过树状数组,也不知道啥叫离散化(貌似好像现在也不懂).百度百科--离散化,把无限空间中无限的个体映射到有限的空间中去,以此提高算法的时空效率. 这道题是dp题,离散化和树状数 ...

随机推荐

  1. .net 获取https页面的信息 在iis7.5服务器上不管用

    让我纠结了一天多的问题,给大家看下,有相同情况的可以不用浪费时间了,本人当时找了好半天都没找到什么有用的信息,项目在本地没有问题,但部署在服务器后,获取不到https页面的信息,加入下面的代码就可以了 ...

  2. 多次快速点击相同button导致重复响应的问题

    Button在开发中经常用到,但是如果在瞬间点击多次时会出现多次响应事件的问题,今天给大家分享一下解决方法. 方法一:在Button响应事件中禁止Button允许点击, -(void)buttonAc ...

  3. db2 Hidden columns

    When a table column is defined with the implicitly hidden attribute, that column is unavailable unle ...

  4. UVA 10252

    按照字典序输出最长公共子序列 #include<time.h> #include <cstdio> #include <iostream> #include< ...

  5. 第二课 less的学习以及移动端需要注意的问题

    一.LESS的学习笔记: 1.less介绍:一种动态样式语言.less将css赋予了动态语言的特性,如变量,继承,运算,函数,less既可以在客户端上运行(支持IE6+,webkit,firefox) ...

  6. 三、jQuery--jQuery基础--jQuery基础课程--第8章 jQuery 实现Ajax应用

    1.使用load()方法异步请求数据 使用load()方法通过Ajax请求加载服务器中的数据,并把返回的数据放置到指定的元素中,它的调用格式为:load(url,[data],[callback]) ...

  7. 【C#】 用Route进行URL重写

    在.NET Framework 4中,微软推出了Route机制.这种机制不仅在MVC中大量运用,在WebForm中也可以使用. 和Contex.RewritePath()一样,Route功能也是写在G ...

  8. Android Studio 配置

    Android配置:[转]原地址:http://www.cnblogs.com/smyhvae/p/4022844.html [开发环境] 物理机版本:Win7旗舰版(64位) Android Stu ...

  9. 【翻译五】java-中断机制

    Interrupts An interrupt is an indication to a thread that it should stop what it is doing and do som ...

  10. poj 2503:Babelfish(字典树,经典题,字典翻译)

    Babelfish Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 30816   Accepted: 13283 Descr ...