Uva - 10340 - All in All(指针扫描)
2013-07-31 15:02
260 查看
题意 :给出两个字符串s、t,问s是不是t的子串(不用连续)。
题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=457&problem=1281
——>>一个个扫描……感觉这次写得挺。。。
题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=457&problem=1281
——>>一个个扫描……感觉这次写得挺。。。
#include <iostream> #include <string> using namespace std; int main() { string s, t; while(cin >> s >> t){ int len_s = s.length(), len_t = t.length(), i, j; for(i = 0, j = 0; i < len_t; i++){ if(t[i] == s[j] && (++j) == len_s) break; } if(j == len_s) cout << "Yes" << endl; else cout << "No" <<endl; } return 0; }
相关文章推荐
- All in All UVA - 10340
- Uva - 10340 - All in All
- UVA 10340 All in All
- [UVA]10340 All in All
- UVa 10340 All in All (水题,匹配)
- H - All in All UVA - 10340
- uva 10340 All in All(字符串处理)
- (入门) uva 10340 All in all
- UVa 10340 - All in All【水】
- 算法竞赛入门经典第三章3-9 All in All UVA - 10340
- UVA 10340 All in All
- Uva - 10340 - All in All
- UVA 10340 - All in All
- uva 10340 All in All
- uva 10340 All in All
- UVa 10340 All in All
- UVA - 10340 All in All
- uva 10340 - All in All
- UVa 10340 All in All(子序列)
- UVA 10340 All in All