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 原来是 l1>=l2 必须改为 l1>l2 (附代码)

Posted by 810974380 at 2009-07-20 21:13:43 on Problem 1936
#include<iostream>
#include<cstring>
using namespace std;
int fun(char *a,char *b)
{ int i,j,s=0;
  int l1=strlen(a),l2=strlen(b);
  if(l1>l2) return 0;
  else {
   for(i=0,j=0;i<l1,j<l2;j++)
  {if(a[i]==b[j]) {s++;i++;}
   else continue;
  }
	if(s==l1) return 1;
	else return 0;
  }
}
int main()
{ char m[100000],n[100000];
 while(cin>>m>>n)
 { if(fun(m,n)==1) cout<<"Yes"<<endl;
   else cout<<"No"<<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