| ||||||||||
| 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>
char s[100];
int main()
{
int n,i,j,l,num,max;
while(scanf("%d",&n)!=EOF)
{
if(n==0)
break;
num=1;
max=0;
scanf("%s",s);
l=strlen(s);
for(i=1;i<l;i++)
{
for(j=0;j<i;j++)
{
if(s[i]==s[j])
{
num--;
break;
}
if(i==j+1)
num++;
if(num>max)
max=num;
}
}
if(max>n)
{
printf("%d customer(s) walked away.\n",max-n);
}
else
printf("All customers tanned successfully.\n");
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator