Secrete Master Plan
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 138 Accepted Submission(s): 101
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.
(starting from 1) and y is either "POSSIBLE" or "IMPOSSIBLE" (quotes for clarity).
給你個兩個二階矩陣,問是否能通過旋轉相等;
解題思路:
水題,模擬;
代碼:
#include <iostream>
#include <stdlib.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <sstream>
using namespace std;
int map[5][5];
int num[5][5];
int main()
{
int t,n;
int cas=0;
scanf("%d",&t);
while(t--)
{
bool flag=false;
scanf("%d%d%d%d",&map[1][1],&map[1][2],&map[2][1],&map[2][2]);
scanf("%d%d%d%d",&num[1][1],&num[1][2],&num[2][1],&num[2][2]);
if(num[1][1]==map[1][1]&&num[1][2]==map[1][2]&&num[2][1]==map[2][1]&&num[2][2]==map[2][2])
flag=true;
else if(num[1][1]==map[2][1]&&num[1][2]==map[1][1]&&num[2][1]==map[2][2]&&num[2][2]==map[1][2])
flag=true;
else if(num[1][1]==map[2][2]&&num[1][2]==map[2][1]&&num[2][1]==map[1][2]&&num[2][2]==map[1][1])
flag=true;
else if(num[1][1]==map[1][2]&&num[1][2]==map[2][2]&&num[2][1]==map[1][1]&&num[2][2]==map[2][1])
flag=true;
if(flag)
printf("Case #%d: POSSIBLE\n",++cas);
else
printf("Case #%d: IMPOSSIBLE\n",++cas);
}
return 0;
}