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 15700764631 at 2016-01-07 09:41:39 on Problem 1250
#include"stdio.h"
void main()
{
	char ch;
	int n,a[500]={0},bo[500]={0},count,sum,max;
	while(scanf("%d",&n)!=EOF&&n!=0)
	{
		getchar();
		sum=0;
		count=0;
		max=0;
		while((ch=getchar())!='\n')
		{
				if(bo[ch]==0)
				{
					bo[ch]=1;
					if(sum<n)
					{
						sum++;
						a[ch]=1;
					}
					else count++;
				}
				else
				{
					bo[ch]=0;
					if(bo[ch]==0&&a[ch]==1)
					{
						sum--;
						a[ch]=0;
					}
				}
		}
		if(count==0)printf("All customers tanned successfully.\n");
		else printf("%d customer(s) walked away.\n",count);
	}
}

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