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 |
搞不清楚为什么WA,哪位牛人帮忙指点一下?#include "iostream" using namespace std; void main(){ char name[10000][50],temp_name[50],project[100][50]; bool flag; int temp,position,i,j,k,big,bigger,stu,sum=0,num[100],standing[100]; stu=0,bigger=10000,memset(num,0,sizeof(num)),memset(standing,0,sizeof(standing)); while (cin.getline(temp_name,30)) { if (temp_name[0]=='0') { break; }else if (temp_name[0]=='1') { for(j=0;j<sum;){ for(big=0,i=0;i<sum;i++){ if (num[i]>big&&num[i]<bigger) { big = num[i]; } } bigger=big; for(i=0,position=0;i<sum;i++){ if (num[i]==big) { standing[j++]=i; position++; } } if (position>1) { for(stu=j-position;stu<j-1;stu++){ for(k=stu+1;k<j;k++) if ((strcmp(project[standing[stu]],project[standing[k]])==1)&&standing[stu]<standing[k]) { temp = standing[stu]; standing[stu] = standing[k]; standing[k] = temp; } } } } for(i=0;i<sum;i++) cout<<project[standing[i]]<<" "<<num[standing[i]]<<endl; stu=0,bigger=10000,sum=0,memset(num,0,sizeof(num)),memset(standing,0,sizeof(standing)); }else if(temp_name[0]>=65&&temp_name[0]<=90){ strcpy(project[sum++],temp_name); }else if (temp_name[0]>=97) { flag = true; for(i=0;i<stu;i++) if (strcmp(temp_name,name[i])==0) { flag = false; for(j=0,position=0;j<sum;j++) { position+=num[j]; if (num[j]>0&&position>=i+1) { if (j==sum-1) { }else num[j]--; break; } } break; } if (flag) { strcpy(name[stu++],temp_name); num[sum-1]++; } } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator