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; int main() { int n; char ar[500]; char ts[21]; while(1) { scanf("%d",&n); if(n==0) break; cin>>ar; int sum; for(int j =0;j<n;j++) ts[j]='0'; int i=0; sum=0; while(1) { int f0 = 1; if(ar[i]==ar[i]+1)i+=2; for(int h =0;h<n;h++) if(ts[h]=='0') { f0 = 0;break; } int kk; if(f0 == 1) for( kk=0;kk<n;kk++) if(ar[i]==ts[kk]) break; for(int k = 0;k<n;k++){ if(ts[k]=='0'){ ts[k]=ar[i];break; } if(ts[k] == ar[i]) { ts[k]='0';break; } } if(kk==n) sum++; i++; if(i==strlen(ar)) break; } if(sum==0) printf("All customers tanned successfully.\n"); else printf("%d customer(s) walked away.\n",sum/2); } //system(" pause "); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator