| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
此题数据有问题 不需要考虑位置也能过In Reply To:此题是不是说只要六个边相等就一样 不用管相对位置??我就这样过了。。。 Posted by:testcase at 2009-03-19 00:53:59 #include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
struct Node
{
int num[6];
}a[100010];
bool cmp(Node h, Node k)
{
for(int i=0;i<6;i++)
{
if(h.num[i]!=k.num[i]) return h.num[i]<k.num[i];
}
return h.num[0]<k.num[0];
}
bool equal(Node h,Node k)
{
for(int i=0;i<6;i++)
{
if(h.num[i]!=k.num[i]) return false;
}
return true;
}
int main()
{
int n;
while(scanf("%d",&n)==1)
{
int flag=0;
for(int i=0;i<n;i++)
{
for(int j=0;j<6;j++) scanf("%d",&a[i].num[j]);
sort(a[i].num,a[i].num+6);
}
sort(a,a+n,cmp);
for(int i=1;i<n;i++)
{
if(equal(a[i],a[i-1]))
{
flag=1;
break;
}
}
if(flag) printf("Twin snowflakes found.\n");
else printf("No two snowflakes are alike.\n");
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator