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 dingding1988 at 2010-02-01 22:22:54 on Problem 1936
#include<stdio.h>
#include<string.h>
int main()
{char a[100002],b[100002];
 int i,j;
 while(scanf("%s %s",a,b)!=EOF)
   {i=0,j=0;
    for(;j<strlen(b);j++)//关键步骤,只判定b数组是否到头,复杂度o(n),
     {
	  if(a[i]==b[j]) 
	   i++;
     }
     if(i==strlen(a))printf("Yes\n");
      else printf("No\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