poj-3302
来源:互联网 发布:迅雷 知乎 编辑:程序博客网 时间:2024/05/06 12:27
reverse();View Code
#include<cstring>#include<string.h>#include<algorithm>#include<iostream>#include<string>using namespace std;string s1,s2;bool ok(string ss1,string ss2){ int i=0,j=0; while(ss1[i]!='\0'&&ss2[j]!='\0') { if(ss1[i]==ss2[j]) j++; i++; } if(j<ss2.length()) return false; else return true;}int main(){ int t; scanf("%d",&t); while(t--) { cin>>s1>>s2; if(ok(s1,s2)) { printf("%s\n","YES"); continue; } reverse(s2.begin(),s2.end()); if(ok(s1,s2)) printf("%s\n","YES"); else printf("%s\n","NO"); } system("pause"); return 0;}
0 0
- poj-3302
- POJ-3302
- [POJ] 3302 Subsequence
- poj 3302 LCS水题
- POJ 3302 Subsequence G++
- POJ
- poj
- POJ
- POJ
- poj
- poj
- POJ
- POJ
- poj
- POJ
- POJ
- POJ
- POJ
- poj-1426(转)
- zzuli训练赛_05_13-K
- zzuli训练赛_05_13-D
- 辽宁省赛——杨鲁斯卡尔专场 -F
- 辽宁省赛——杨鲁斯卡尔专场-J
- poj-3302
- poj-3438
- jQeury入门:遍历
- poj-3627
- poj--3173
- poj--3086
- poj--2608
- poj--2608
- poj--2782