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 |
新手求助——ps[501]为什么不对啊 开到10001就对 很是不明白——#include <stdio.h> #include <string.h> int ps[501];//player's score int main() { int N,M,i,t,t1,t2,f,s; while(scanf("%d%d",&N,&M)!=EOF&&N) { memset(ps,0,sizeof(ps)); scanf("%d",&t); ps[t]++; t1=t2=t; for(i=1;i<N*M;i++) { scanf("%d",&t); ps[t]++; if(t<t1) t1=t; if(t>t2) t2=t; } for(i=t1,f=1;i<=t2;i++) if(ps[i]>f) f=ps[i]; for(i=t1,s=0;i<=t2;i++) { if(ps[i]!=f && ps[i]>s) s=ps[i]; } for(i=t1;i<=t2;i++) if(ps[i]==s) printf("%d ",i); printf("\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