码迷,mamicode.com
首页 > 其他好文 > 详细

hdu 5540 Secrete Master Plan(水)

时间:2015-12-02 22:35:35      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:

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 didnt know the correct direction to hold the sheet. What a pity!

Given two secrete master plans. The first one is the masters 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

 

 

 

Source

 

技术分享
 1 #pragma comment(linker, "/STACK:1024000000,1024000000")
 2 #include<iostream>
 3 #include<cstdio>
 4 #include<cstring>
 5 #include<cmath>
 6 #include<math.h>
 7 #include<algorithm>
 8 #include<queue>
 9 #include<set>
10 #include<bitset>
11 #include<map>
12 #include<vector>
13 #include<stdlib.h>
14 #include <stack>
15 using namespace std;
16 #define PI acos(-1.0)
17 #define max(a,b) (a) > (b) ? (a) : (b)
18 #define min(a,b) (a) < (b) ? (a) : (b)
19 #define ll long long
20 #define eps 1e-10
21 #define MOD 1000000007
22 #define N 1000000
23 #define inf 1e12
24 int x[6],y[6];
25 int main()
26 {
27    int t;
28    int ac=0;
29    scanf("%d",&t);
30    while(t--){
31       for(int i=1;i<=4;i++){
32          scanf("%d%d",&x[i],&y[i]);
33       }
34       int ans=x[3]*100000+y[3]*1000+y[4]*100+x[4];
35 
36       printf("Case #%d: ",++ac);
37       if(x[1]*100000+y[1]*1000+y[2]*100+x[2]==ans){
38          printf("POSSIBLE\n");
39          continue;
40       }
41       if(y[1]*100000+y[2]*1000+x[2]*100+x[1]==ans){
42          printf("POSSIBLE\n");
43          continue;
44       }
45       if(y[2]*100000+x[2]*1000+x[1]*100+y[1]==ans){
46          printf("POSSIBLE\n");
47          continue;
48       }
49       if(x[2]*100000+x[1]*1000+y[1]*100+y[2]==ans){
50          printf("POSSIBLE\n");
51          continue;
52       }
53       printf("IMPOSSIBLE\n");
54 
55    }
56     return 0;
57 }
View Code

 

hdu 5540 Secrete Master Plan(水)

标签:

原文地址:http://www.cnblogs.com/UniqueColor/p/5014154.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!