UVa 10340 - All in All
来源:互联网 发布:噪声测量软件 编辑:程序博客网 时间:2024/05/16 07:53
Problem E
All in All
Input: standard input
Output: standard output
Time Limit: 2 seconds
Memory Limit: 32 MB
You have devised a new encryption technique whichencodes a message by inserting between its characters randomly generatedstrings in a clever way. Because of pending patent issues we will not discussin detail how the strings are generated and inserted into the original message.To validate your method, however, it is necessary to write a program thatchecks if the message is really encoded in the final string.
Given two strings s and t, you haveto decide whether s is a subsequence oft, i.e. if you can removecharacters from t such that the concatenation of the remainingcharacters iss.
Input Specification
The input contains several testcases. Each isspecified by two strings s, t of alphanumeric ASCII characters separatedby whitespace. Input is terminated by EOF.
Output Specification
For each test case output, if s is asubsequence of t.
Sample Input
sequence subsequence
person compression
VERDI vivaVittorioEmanueleReDiItalia
caseDoesMatter CaseDoesMatter
SampleOutput
Yes
No
Yes
No
Source: ULM Local Contest
#include <stdio.h>#include <string.h>#include <math.h>char s1[1000000],s2[1000000];int main(){ int i,j,n,m,s,t; int l1,l2; while(scanf("%s %s",s1,s2)!=EOF) { l1=strlen(s1); l2=strlen(s2); for(i=0,j=0;j<=l2-1&&i<=l1-1;j++) { if(s2[j]==s1[i]) { i++; } } if(i==l1) { printf("Yes\n"); }else { printf("No\n"); } } return 0;}
- 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
- 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
- 学习java三大框架的总结
- java环境配置
- 阿灵顿国家公墓GIS应用介绍
- 源代码管理十诫
- OA初战总结
- UVa 10340 - All in All
- 如何使用代码动态的获取和设置ImageView的宽度和高度?
- Struts1与Struts2的区别
- 2013 C++第一周任务 季节
- HUD_2015 偶数求和
- Linux 进程间通信--- 共享内存
- 终于摆脱windows能在纯净的linux开发了
- gbs使用手册之gbs chroot
- Chrome Developer Tools 调试 js