Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

老子的代码那儿出错了呢?

Posted by bingshen at 2010-07-10 17:57:21 on Problem 1250
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator