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 kakazwy22 at 2011-03-20 21:21:57 on Problem 1250
#include<iostream>
#include <vector>
using namespace std;

int main()
{
	int n;
	cin>>n;
	while(n)
	{
		int count=0;
		vector<char>V;
	
		char ch[1000];
		cin>>ch;
		int j=0;
		while(ch[j]!='\0')
		{
			int work;
			if(V.size()!=0)
			{
				work=1;
				for(int i=0;i<V.size();i++)
				{	
					if(V[i]==ch[j])
					{
						V.erase(V.begin()+i);
						work=0;
						break;
					}
				}
				if(work)
				{
					V.push_back(ch[j]);
					if(V.size()>n) count++;
				}
			}			
			else V.push_back(ch[j]);
			j++;
		}
		if(count)
		{
			cout<<count<<" customer(s) walked away."<<endl;
			return 0;
		}
		else 
		{
			cout<<"All customers tanned successfully."<<endl;
			return 0;
		}

	}
	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