| ||||||||||
| 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 | |||||||||
Re:没看懂你的程序...本人刚学C...直接贴我的好了In Reply To:没看懂你的程序...本人刚学C...直接贴我的好了 Posted by:Spacesheep at 2005-08-20 22:52:02 > #include<stdio.h>
> #include<string.h>
> int i,j,n,m;
>
> bool p[1000],check[1000];
> char s[500];
>
>
> void main(){
> while(scanf("%d",&n),n){
> memset(p,0,sizeof(p));
> memset(check,0,sizeof(check));
> scanf(" %s ",s);
> m=0;
> for (i=0;i<strlen(s);i++){
> if (p[s[i]]){p[s[i]]=0;if (!check[s[i]])n++;else m++;}
> else
> {p[s[i]]=1;if (n) n--;else check[s[i]]=1;};
> };
> if (m) printf("%d customer(s) walked away.\n",m);
> else printf("All customers tanned successfully.\n");
> };
> return;
> };
>
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator