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 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 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
");
39          continue;
40       }
41       if(y[1]*100000+y[2]*1000+x[2]*100+x[1]==ans){
42          printf("POSSIBLE
");
43          continue;
44       }
45       if(y[2]*100000+x[2]*1000+x[1]*100+y[1]==ans){
46          printf("POSSIBLE
");
47          continue;
48       }
49       if(x[2]*100000+x[1]*1000+y[1]*100+y[2]==ans){
50          printf("POSSIBLE
");
51          continue;
52       }
53       printf("IMPOSSIBLE
");
54 
55    }
56     return 0;
57 }
View Code
原文地址:https://www.cnblogs.com/UniqueColor/p/5014154.html