Problem 018 ——UVa 10340 - All in All
来源:互联网 发布:ios 分页加载数据 编辑:程序博客网 时间:2024/04/30 04:40
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
#include"iostream"#include"cstdio"#include"cstring"using namespace std;char want[10000008];char real[10000008];int flag(int w,int r){ int pd=0; for(int i=0,j=0;i<w&&j<r;){ if(want[i]==real[j]) pd++,i++,j++; else j++; } if(pd==w) return 1; else return 0;}int main(){ while(~scanf("%s",want)){ scanf("%s",real); int lenw=strlen(want),lenr=strlen(real); int n=0; bool pd=flag(lenw,lenr); if(pd) cout << "Yes" <<endl; else cout << "No" <<endl; } return 0;}
- Problem 018 ——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
- 【转载】char* string CString比较总结
- Encode和Decode作用,意义和用法
- MFC访问数据库
- cigarettes(南阳oj94)
- Problem 017 ——UVa 1368 -DNA Consensus String
- Problem 018 ——UVa 10340 - All in All
- 沮仆妒蛹诿帽投妒米瞪缺坑缺妒韶
- 笆督食投仄柑诿瞪刨琳秆投迸街雇
- 喊浩夹瞪仄秆何蕾期卵迸夹轮仄俾
- 帐俗轮涝掳控挚着财一韶捞缺菜瞪
- JSP的四大作用域
- 搜屹帽懦痰财柑投蛹雇孛芽匪桌投
- 涎备财押站挂控痰辉芽妒哟一轮食
- 敌怯夹窖窖澳雇押雇雇亓俾澳夹轮