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

why WA,is there any test cases???

Posted by 771385494 at 2012-04-14 20:15:36 on Problem 3458
#include <iostream>
#include <cstring>
using namespace std;

int main()
{
	int nCases,i,j;
	char target[101],str1[101],str2[101];
	cin >> nCases;
	while(nCases--){
		cin >> target >> str1 >> str2;
		int currentJ = 0;
		bool win = false;
		
		for(i = 0;i < strlen(target);) {
			if(currentJ == strlen(str1))
				break;
			i++;
			for(j = currentJ;j < strlen(str1);j++) 
				if(str1[j] == target[i] || str2[j] == target[i] || str1[j] == '*'){
					currentJ = j + 1;
					break;
				}
				else
					currentJ++;
		}
		if(i == strlen(target))
			win = true;
		if(win == true)
			cout << "win" <<endl;
		else
			cout << "lose" <<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