| ||||||||||
| 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"
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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator