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 |
为什么还是错的呢?高手指点一下!!!!!#include<stdio.h> struct dat { int a; int b; }; int pan(struct dat *p1,struct dat *p2) { if((!((p1->a+p2->a)%2))&&(!((p1->a+p2->a)%2))) { p2->a=0; p2->b=0; return 1; } else return 0; } int main() { struct dat a[10010]; int n,i,temp1,temp2,j; while((scanf("%d",&n))!=EOF){ if(n==0) { printf("*\n"); return 1; } for(i=1;i<=n;i++) { scanf("%d%d",&temp1,&temp2); if(temp1>temp2) { a[i].a=temp2; a[i].b=temp1; } else { a[i].a=temp1; a[i].b=temp2; } } temp2=1; for(i=1;i<=n;i++) { temp1=1; if(a[i].a==0)continue; for(j=i+1;j<=n;j++) { if(a[j].a==0)continue; if(pan(&a[i],&a[j])) temp1++; } if(temp1>temp2) temp2=temp1; } printf("%d\n",temp2); } return 1; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator