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 penghaitao at 2013-09-21 16:43:56 on Problem 1250
#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:
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