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. 【转】VS项目属性的一些配置项的总结

    首先,解决方案和项目文件夹包含关系(c++项目): VS解决方案和各个项目文件夹以及解决方案和各个项目对应的配置文件包含关系,假设新建一个项目ssyy,解决方案起名fangan,注意解决方案包括项目, ...

  2. JS判断是否为IE浏览器 包含了IE11

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD ...

  3. 51nod1069(nim博弈)

    题目链接: http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1069 题意: 中文题诶~ 思路: 一开始我以为需要把上一堆到 ...

  4. JS ——window.onload与$(document).ready()

    我们常常在页面加载完成以后做一些操作,比如一些元素的显示与隐藏.一些动画效果.我们通常有两种方法来完成这个事情,一个就是window.onload事件,另一个就是JQuery的ready()方法.那么 ...

  5. NYOJ题目436sum of all integer numbers

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAr0AAAHKCAIAAACBiWRrAAAgAElEQVR4nO3dP1LjSts34G8T5CyEFB

  6. 关于logcat日志

    最近学习android,碰到了logcat,个人总结一下. 当不出日志是解决办法: ProjectMenu---后台设置----LOG设置---LOG开关 Logcat(deprecated)和Log ...

  7. 加载gif动画的三种方式

    GifView.h/** * 调用结束就开始播放动画,如果需要用户指定何时播放的话,只需要把timer的开始放到合适的位置.通过对CFDictonaryRaf 也就是gifProperties的改变, ...

  8. JS手机浏览器判断(转)

    整理查询一下,js判断手机浏览器的方法 <script type="text/javascript"> /* * 智能机浏览器版本信息:包括微信内置 * */ var ...

  9. 攻城狮在路上(壹) Hibernate(七)--- 通过Hibernate操纵对象(下)

    一.与触发器协同工作: 当Hibernate与数据库的触发器协同工作时,会出现以下两类问题: 1.触发器使Session缓存中的数据和数据库中的不一致: 出现此问题的原因是触发器运行在数据库内,它执行 ...

  10. go sample - format

    go sample - format package mainimport "fmt"import "os"type point struct { x, y i ...