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 |
本人小菜 希望高手们帮忙看看错在那里,望提些意见#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator