UVa10340
来源:互联网 发布:软件开发北京 编辑:程序博客网 时间:2024/06/06 23:18
题目链接
分析:
两个指针从前往后扫
当然,还有一种更好的方法:
直接循环t,len作为s的指针,相等时len++,最后比较len和strlen(s)
//这里写代码片#include<cstdio>#include<cstring>#include<iostream>using namespace std;char s[1000010],t[1000010];int main(){ while (scanf("%s%s",&s,&t)!=EOF) { int len=0; for (int i=0;i<strlen(t);i++) if (s[len]==t[i]) len++; if (len==strlen(s)) printf("Yes\n"); else printf("No\n"); } return 0;}
阅读全文
0 0
- UVA10340
- uva10340
- UVa10340
- UVa10340
- uva10340
- Uva10340
- Uva10340
- Uva10340
- UVA10340
- uva10340
- UVa10340
- UVA10340
- uva10340
- UVa10340
- UVa10340
- UVa10340
- Uva10340 All in All
- uva10340 - All in All
- 一些关于字符串的函数
- 利用eolinker实现api接口mock测试(mock server)
- 如何使用Retrofit写一个Android的REST客户端的小教程
- 生成二维码
- Spring @Transactional原理及使用
- UVa10340
- Codeforces876B-Divisiblity of Differences
- log4j日志配置
- 高精度练习之加法
- 自定义过滤器filter
- android webview 遇到android.os.FileUriExposedException错误
- HTML angular单选按钮
- SQLiteException: not an error (code 0): Could not open the database in read/write mode
- Broadcom BCM94360系列网卡Linux(Ubuntu/Fedora)驱动安装总结