| ||||||||||
| 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<iostream>
using namespace std;
int main()
{
int n,m,temp,s,i,j;
char a[1000];
while(cin>>n&&n)
{
cin>>a;
n--;
temp=n;
m=0;
for(i=1;a[i]!='\0';i++)
{
for(j=0;j<i;j++)
if(a[i]==a[j])
{
a[i]='0';
a[j]='0';
n++;
}
if(n==temp)
n--;
if(n<0)
{
m++;
n=0;
}
temp=n;
}
if(m==0)
cout<<"All customers tanned successfully."<<endl;
else
cout<<m<<" customer(s) walked away."<<endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator