Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
帮帮小弟-这道题是不是有什么边界条件或特殊数据我的程序如下: // 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator