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?for(ps=s,ii=0,pt=t; (ii<len_s)&&(pt=strchr(pt,*ps));ii++,ps++)

Posted by ning at 2005-12-15 08:56:57 on Problem 1936
/*pku 1936  All in All    051213   */
/* s is a subsequence of t*/
#define N 100000
#include<stdio.h>
#include<string.h>
int main()
{
    char s[N],t[N];
    long ii;
    char *p1,*ps,*pt;
    long len_s;
    for(;scanf("%s%s",s,t)!=EOF;)
    {
        len_s=strlen(s);
        for(ps=s,ii=0,pt=t; (ii<len_s)&&(pt=strchr(pt,*ps));ii++,ps++)
           /* printf("%c %c",*pt,*ps);*/;
        if(ii==len_s)
            printf("Yes\n");
        else
            printf("No\n");
    }
}

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