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

wrong answer !!!!

Posted by ahura_24 at 2011-09-14 17:49:32 on Problem 2250 and last updated at 2011-09-14 17:52:24
this is my code but i dont know why take wrong :( please help me or give me a sample input to check my code.

#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

///////////////////////////////////////////////////////////////////////

int main()
{
/*	freopen("input.txt", "r", stdin);*/

	char buffer[100];
	vector<string> v1, v2, vResult;
	bool flag;
	
	while ( true )
	{
		v1.clear();
		v2.clear();
		vResult.clear();

		while ( scanf("%s", buffer) != EOF )
		{
			if ( !strcmp(buffer, "#") )
				break;

			v1.push_back( buffer );
		}

		while ( scanf("%s", buffer) != EOF )
		{
			if ( !strcmp(buffer, "#") )
				break;

			v2.push_back( buffer );
		}

		flag = true;

		if ( v1.empty() )
			break;

		for (vector<string>::const_iterator citr = v1.begin(); citr != v1.end(); ++citr)
		{
			if ( count(v2.begin(), v2.end(), *citr) >= 1 && find(vResult.begin(), vResult.end(), *citr) == vResult.end() )
			{
				if ( !flag )
					printf( " " );
				flag = false;

				vResult.push_back( *citr );
				printf("%s", citr->c_str());
			}
		}

		printf( "\n" );
	}

	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