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 |
快排就行了,太水了。while(scanf("%d%d",&m,&n)) { if(m==0&&n==0) break; ans=0; time++; memset(flag,1,sizeof(flag)); for(i=1;i<=n;i++) { scanf("%d",&T[i]); flag[T[i]]=false; } sort(T+1,T+n+1); for(i=n;i>0;i--) { flag[T[i]]=false; for(k=T[i]+1;k<=m*n;k++) if(flag[k]==true) { flag[k]=false; break; } if(k>m*n) ans++; } printf("Case %d: %d\n",time,ans); } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator