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 wojiushi at 2009-05-18 19:53:44 on Problem 1936
#include"stdio.h"
#include"string.h"
int main()
{
    char a[100001],b[100001];
    while(scanf("%s%s",&a,&b)>0)
    {
          int i=0,j,k=0,m=0;
          j=strlen(a);
          if(strlen(a)>strlen(b))
          {
              printf("No\n");
              continue;
          }
          else
          {
              while(i<strlen(b))
              {
                  if(a[k]==b[i])
                  {
                      ++m;
                      if(m==j)
                      {
                                      printf("Yes\n");
                                      break;
                      }
                      ++k;
                      if(k==j)
                      {
                              break;
                      }
                  }
                  ++i;
              }
              if(m!=j)
              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