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

wa求助!!求测试数据!!

Posted by 20101289 at 2012-04-19 07:56:29 on Problem 1250
#include<iostream>
using namespace std;
int main()
{
	int n;
	char ar[500];
	char ts[21];
	while(1)
	{
		scanf("%d",&n);
		if(n==0)
			break;
		cin>>ar;
		int sum;

		for(int j =0;j<n;j++)
			ts[j]='0';
		int i=0;
			sum=0;
			while(1)
			{	
				int f0 = 1;
				if(ar[i]==ar[i]+1)i+=2;
				for(int h =0;h<n;h++)
					if(ts[h]=='0')
					{
						f0 = 0;break;
					}
					int kk;
				if(f0 == 1)
					for( kk=0;kk<n;kk++)
						if(ar[i]==ts[kk])
							break;
				
				for(int k = 0;k<n;k++){
					if(ts[k]=='0'){
						ts[k]=ar[i];break;
					}
					
					if(ts[k] == ar[i])
					{
						ts[k]='0';break;
					}
				}
				
				
				if(kk==n)
					sum++;
				i++;

				if(i==strlen(ar))
					break;
			}
			if(sum==0)
				printf("All customers tanned successfully.\n");
			else
				printf("%d customer(s) walked away.\n",sum/2);

		
		

	}
	//system(" pause ");
	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