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:果断暴力,不解释!【附暴力AC代码】 Posted by:luchenqun at 2010-10-13 13:29:44 #include<iostream> #include<cstdio> #include<algorithm> using namespace std; bool flag; struct node { int edge[6]; void isort() { sort(edge,edge+6); } void get() { scanf("%d%d%d%d%d%d",&edge[0],&edge[1],&edge[2],&edge[3],&edge[4],&edge[5]); } }snow[100005]; bool cmp(struct node a,struct node b) { for(int i=0;i<6;i++) { if(a.edge[i]==b.edge[i]) continue; return a.edge[i]<b.edge[i]; } flag=true; return true; } int main() { int n; register int i; while(scanf("%d",&n)!=EOF) { for(i=0;i<n;i++) { snow[i].get(); snow[i].isort(); } flag=false; sort(snow,snow+n,cmp); 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