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> int main() { int n,k; int p,s[1001]; int used[1001]={0}; int i,j,t,position,num; char ch; scanf("%d %d",&n,&k); t=0; for (i=1;i<=k;i++){ scanf("%d",&p); for (j=1;j<=2*p;j++) scanf("%d",&s[j]); scanf("%1s",&ch); if (ch=='=') for (j=1;j<=2*p;j++) used[s[j]]--; else { for (j=1;j<=2*p;j++) used[s[j]]++; t++; } } num=0; for (i=1;i<=n;i++) if (used[i]==t) { position=i; num++; } if(num==1) printf("%d\n",position); else printf("0\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