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"stdio.h" #include"string.h" main() { int beds,length,top,i,j,k,result; char person[1000],state[1000]; while(EOF!=scanf("%d",&beds)&&beds!=0) { for(i=0;i<1000;i++) { person[i]=state[i]=0; } top=0; result=0; scanf("%s",person); length=strlen(person); for(i=0;i<length;i++) { if(state[person[i]]=='1') { top-=1; state[person[i]]=0; } else { state[person[i]]='1'; top+=1; } result=result>top?result:top; } if(result-beds<=0) { printf("All customers tanned successfully.\n"); } else { printf("%d customer(s) walked away.\n",result-beds); } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator