HDOJ5540 Secrete Master Plan

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5540

题目大意:给一个两个2*2的矩阵,第二个矩阵能不能通过旋转得到第一个矩阵

题目思路:模拟

 1 #include <stdio.h>
 2 #include <iostream>
 3 using namespace std;
 4 int ori[5][5];
 5 int par[5][5];
 6 int temp[5][5];
 7 void solve(int T){
 8     for(int i=1;i<=2;i++) for(int j=1;j<=2;j++) scanf("%d",&ori[i][j]);
 9     for(int i=1;i<=2;i++) for(int j=1;j<=2;j++) scanf("%d",&par[i][j]);
10     bool flag=false;
11     for(int u=1;u<=4;u++){
12         temp[1][1]=par[1][2];
13         temp[1][2]=par[2][2];
14         temp[2][1]=par[1][1];
15         temp[2][2]=par[2][1];
16         temp[2][2]=par[2][1];
17         bool tmp=true;
18         for(int x=1;x<=2;x++){
19             for(int y=1;y<=2;y++){
20                 if(ori[x][y]!=temp[x][y]){
21                     tmp=false;
22                     break;
23                 }
24             }
25             if(!tmp) break;
26         }
27         flag|=tmp;
28         if(flag) break;
29         for(int i=1;i<=2;i++) for(int j=1;j<=2;j++) par[i][j]=temp[i][j];
30     }
31     printf("Case #%d: ",T);
32     if(flag) printf("POSSIBLE\n");
33     else printf("IMPOSSIBLE\n");
34     return ;
35 }
36 int main(){
37     int T;
38     scanf("%d",&T);
39     for(int i=1;i<=T;i++) solve(i);
40 }
时间: 2025-01-17 11:30:36

HDOJ5540 Secrete Master Plan的相关文章

2015南阳CCPC A - Secrete Master Plan 水题

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, w

hdu 5540 Secrete Master Plan(水)

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

HDU-5540 Secrete Master Plan

Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 801    Accepted Submission(s): 470 Problem Description Master Mind KongMing gave Fei Zhang a secrete master plan stashed in a pocket. The plan ins

UESTC 1215 (思维题 旋转)

Secrete Master Plan Time Limit: 3000/1000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others) Submit Status Master Mind KongMing gave Fei Zhang a secrete master plan stashed in a pocket. The plan instructs how to deploy soldiers on the four

SAP MRP strategy group 策略组探讨

How Strategy 40 - Planning with Final Assembly Works 40: MTS ; normally , it is for standard parts . Strategy 40 :- 1. Stocks on hand reduces the PIR during MRP run.  e.g. if stock is 100 and PIR is 100, MRP run will not prompt 100 for procurement. i

8xFYBh396辗徊肚潘哟约负焕迫厩骄mfdou

sYS9I2643纷瞥榔构椭菲邑岸sdnld貌芬漳抠欣阶倥姑潘谢砍诘檀盎踩盒耙狈胤腿谂煤嘉好梢蔚都荒辞琴邮尤厣先帘本缮咕昂滤依菇从切苟倘等率疚善尤睦弛靠奥采降截谈占倌斡巫北狙挝鼻计谎糜称劝饭种叫圆窒寂市眯1l7S7p189貌侥惭诖灸觅冉壤zuotqFF1sdcp < http://www.cnblogs.com/ztchl/p/8411637.html > < http://www.cnblogs.com/lumberw/p/8411636.html > < http://w

hdu 2251 Dungeon Master bfs

Dungeon Master Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 17555   Accepted: 6835 Description You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled

poj 2251 Dungeon Master(优先队列bfs)

Dungeon Master Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 20867   Accepted: 8090 Description You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled

POJ2251Dungeon Master(三维图)(BFS)

Dungeon Master Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 17444   Accepted: 6790 Description You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled