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 |
纪念我的第一次,一次AC&0MS(慎入,有代码)#include<stdio.h> main() { int m,n,i,p,e,r,max,jl,js=1; int w[51]; while(scanf("%d %d",&m,&n)!=EOF) { if(m==0) break; for(i=1;i<=n;i++) { scanf("%d",&w[i]); } for(p=m*n,e=0,r=0;p>0;p--) { for(i=1,max=0;i<=n;i++) { if(max<w[i]) {max=w[i];jl=i;} } if(max==p)w[jl]=0; if(max==p&&r==0) {e++;} else if(max==p&&r!=0){r--;} else{r++;} } printf("Case %d: %d\n",js,e); js++; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator