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呢?

Posted by baimu at 2008-08-07 18:55:58 on Problem 1936
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
    char s[100001],t[100001];
    int sl,tl,i,j;
    while(1)
    {
        memset(s,0,sizeof(s));
        memset(s,0,sizeof(t));
        if(scanf("%s%s",s,t)==EOF)
            break;
        sl=strlen(s);
        tl=strlen(t);
        if(sl>tl)
        {
            printf("No\n");
            continue;
        }
        j=0;
        for(i=0;i<sl&&j<tl;i++)
        {
            while(j<tl&&s[i]!=t[j])j++;
            j++;
        }
        if(i>=sl)
            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