Box UVa 1587
—————————————————————————
题目:UVa1587
—————————————————————————
思路:暴力求解,十分暴力🐶
Sample Input
1345 2584
2584 683
2584 1345
683 1345
683 1345
2584 683
1234 4567
1234 4567
4567 4321
4322 4567
4321 1234
4321 1234
Sample Output
POSSIBLE
IMPOSSIBLE
#include<bits/stdc++.h>
using namespace std;
pair <int,int> p[6];
int main(){
while(1) {
for(int i = 0; i < 6; i++) {
if(!(cin>>p[i].first>>p[i].second)) return 0;
if(p[i].first > p[i].second)
swap(p[i].first,p[i].second);
}
sort(p, p+6);
if(p[0].first==p[1].first && p[0].first==p[2].first && p[0].first==p[3].first && p[0].second==p[1].second &&
p[0].second==p[4].first && p[0].second==p[5].first && p[2].second==p[3].second && p[2].second==p[4].second &&
p[2].second==p[5].second)
printf("POSSIBLE\n");
else
printf("IMPOSSIBLE\n");
}
return 0;
}