| ||||||||||
| 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 | |||||||||
Re:飘过,贴一下代码In Reply To:飘过,贴一下代码 Posted by:dingding1988 at 2010-02-01 22:22:54 > #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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator