大水题!!矩阵旋转模板恰好用上!
/*=============================================================================
#
# Author: liangshu - cbam
#
# QQ : 756029571
#
# School : 哈尔滨理工大学
#
# Last modified: 2015-11-29 21:55
#
# Filename: H.cpp
#
# Description:
# The people who are crazy enough to think they can change the world, are the ones who do !
=============================================================================*/
#include<iostream>
#include<sstream>
#include<algorithm>
#include<cstdio>
#include<string.h>
#include<cctype>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
using namespace std;
void A(int (*arr)[10], int m , int n){
int tmp[100][100];
int dst = m - 1;
for(int i = 0; i <m; i++, dst--){
for(int j = 0; j < m; j++){
tmp[j][dst] = arr[i][j];
}
}
for(int i = 0; i < m; i++){
for(int j = 0; j <n; j++){
arr[i][j] = tmp[i][j];
}
}
}
bool check(int (*arr)[10], int (*arr2)[10]){
if(arr[0][0] == arr2[0][0]){
if(arr[0][1] == arr2[0][1]){
if(arr[1][0] == arr2[1][0]){
if(arr[1][1] == arr2[1][1]){
return 1;
}
}
}
}
return 0;
}
int main()
{
int t;scanf("%d", &t);
int cs = 1;
while(t--){
int cnt[10][10];
for(int i = 0; i < 2; i++){
for(int j = 0; j < 2; j++){
cin>>cnt[i][j];
}
}
int dic[10][10];
for(int i = 0; i < 2; i++){
for(int j = 0; j < 2; j++){
cin>>dic[i][j];
}
}
int flag = 0;
for(int i = 0; i < 4; i++){
if(check(cnt, dic)){
printf("Case #%d: POSSIBLE\n", cs++);flag = 1;break;
}
A(cnt, 2, 2);
// cout<<"fanshu = "<<endl;
// for(int k = 0; k <2;k++){
// for(int m = 0; m < 2; m++){
// cout<<cnt[k][m]<<" ";
// }
// cout<<endl;
// }
}
if(!flag){
printf("Case #%d: IMPOSSIBLE\n", cs++);
}
}
return 0;
}