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 willnow at 2007-12-15 15:16:17 on Problem 3458
我的程序如下:
// acm3468.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include "iostream"
using namespace std;
char S[100],Up[100],Down[100];
int endOfS,endOfCard;

bool Match(int StartOfS,int StartOfCard)
{
	if(StartOfS>endOfS)
		return true;
	if(endOfCard-StartOfCard<endOfS-StartOfS)
		return false;
	int i;
	for(i=StartOfCard;i<=endOfCard-endOfS+StartOfS;i++)
	{
		if((Up[i]=='*'||Up[i]==S[StartOfS]||Down[i]==S[StartOfS])&&Match(StartOfS+1,i+1))
			return true;
	}
	return false;
}
int _tmain(int argc, _TCHAR* argv[])
{
	int num;
	cin>>num;
	char ch;
	cin.get(ch);
	int i;
	int *nums=new int[num];
	for(i=0;i<num;i++)
	{
		endOfS=0;
		for(cin.get(S[endOfS]);S[endOfS]!='\n';cin.get(S[++endOfS]));
		endOfS--;
		endOfCard=0;
		for(cin.get(Up[endOfCard]);Up[endOfCard]!='\n';cin.get(Up[++endOfCard]));
		endOfCard=0;
		for(cin.get(Down[endOfCard]);Down[endOfCard]!='\n';cin.get(Down[++endOfCard]));
		endOfCard--;
		if(Match(0,0))
		{
			nums[i]=1;
		}
		else
		{
			nums[i]=0;
		}
	}
	for(i=0;i<num;i++)
	{
		if(nums[i])
			cout<<"win\n";
		else
			cout<<"lose\n";
	}
	cin>>ch;
	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