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 azheng51714 at 2011-03-22 23:44:28 on Problem 3302
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
int main()
{
    char a[101],b[101],c[101];
    int i,j,n,la,lb,j1,j2;
    cin>>n;
    while(n--)
    {
        scanf("%s %s",a,b);
        la=strlen(a);
		lb=strlen(b);
        j=j1=j2=0;
        for(i=lb-1;i>=0;i--)
        {c[j]=b[i];j++;}
       
        for(i=0;i<=la-1;i++)
        {
           if(a[i]==b[j1])j1++;
           if(a[i]==c[j2])j2++;
        }
       if(j1==lb||j2==lb) cout<<"YES"<<endl;
       else cout<<"NO"<<endl;
    }
    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