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<iostream.h> #include<stdio.h> #include<string.h> #include<stdlib.h> int main() { char name[10000][31],sc[4],nm[41]; int n,m,s,i,j,k,h,lm,sign=0,rank,score[10000]={0},signs[10000]={0}; cin>>n; for(i=0;i<n;i++) { gets(name[i]); if(!sign&&strcmp(name[i],"Li Ming")==0) { lm=i; sign=1; } } cin>>m; for(i=0;i<m;i++) { rank=1; for(j=0;j<n;j++) { gets(nm); for(k=0;nm[k]!=' ';k++) sc[k]=nm[k]; sc[k]='\0'; s=atoi(sc); for(;nm[k]==' ';k++); for(h=0;h<n;h++) if(signs[h]!=i+1&&strcmp(&nm[k],name[h])==0) { score[h]+=s; signs[h]++; break; } } for(j=0;j<n;j++) if(score[j]>score[lm]) rank++; printf("%d\n",rank); } return 1; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator