JOJ2098:All in All
来源:互联网 发布:暴走漫画淘宝店 编辑:程序博客网 时间:2024/04/29 15:12
传送门:http://acm.jlu.edu.cn/joj/showproblem.php?pid=2098
题意:判断一个字符串A是否出现在B中,并且A可以不连续。
思路:将B字符串从头到尾扫一遍,标签i指向A的首位,如果当前B位置的字符与A[i]一样,i++。最后判断i和A.length是否相等。
代码:
#include <stdio.h>#include <string.h>char s[100000],t[100000];int main(){ memset(s,0,sizeof(s)); memset(t,0,sizeof(t)); while (scanf("%s%s",s,t)!=EOF) { int k=0,count=0; int len1=strlen(s); int len2=strlen(t); for (int i=0;i<len2;++i) { if (count<len1) { if (t[i]==s[count]) count++; } else break; } if (count==len1) printf("Yes\n"); else printf("No\n"); } return 0;}
- JOJ2098:All in All
- pku_1936 All in All
- 2098: All in All
- poj1936 All in All
- 10340 - All in All
- POJ1936--All in All
- POJ1936:All in All
- 10340 - All in All
- POJ1936《All in All》
- UVaOJ10340 - All in All
- 10340 - All in All
- All in All
- poj1936 All in All
- poj1936 All in All
- Uva10340 All in All
- uva10340 - All in All
- All in All
- poj1936--All in All
- (算法)二叉树转换为双向链表
- 写程序的注意点
- 软件包 javax.servlet 不存在的解决方法
- synchronized
- shell脚本备份恢复oracle数据库简单示例
- JOJ2098:All in All
- @SuppressWarnings
- 有一种
- 创意组合——friend class + virtual class member
- struts2中iterator标签的相关使用
- apache服务器中如何在html文件中用php代码
- 数据库中的Date,DateTime和TimeStamp类型
- Struts2 标签的使用
- xjad使用中的几个问题