poj 1936 All in All
2024-09-29 10:12:58
All in All
Time Limit: 1000 MS Memory Limit: 30000 KB
64-bit integer IO format: %I64d , %I64u Java class name: Main
Description
You have devised a new encryption technique which encodes a message by inserting between its characters randomly generated strings in a clever way. Because of pending patent issues we will not discuss in detail how the strings are generated and inserted into the original message. To validate your method, however, it is necessary to write a program that checks if the message is really encoded in the final string.
Given two strings s and t, you have to decide whether s is a subsequence of t, i.e. if you can remove characters from t such that the concatenation of the remaining characters is s.
Given two strings s and t, you have to decide whether s is a subsequence of t, i.e. if you can remove characters from t such that the concatenation of the remaining characters is s.
Input
The input contains several testcases. Each is specified by two strings s, t of alphanumeric ASCII characters separated by whitespace.The length of s and t will no more than 100000.
Output
For each test case output "Yes", if s is a subsequence of t,otherwise output "No".
Sample Input
sequence subsequence
person compression
VERDI vivaVittorioEmanueleReDiItalia
caseDoesMatter CaseDoesMatter
Sample Output
Yes
No
Yes
No 题意:第一个串是否是第二个的子串 区分大小写 依旧前几道题暴力的思想
#include <iostream>
#include <string.h>
#include <stdio.h> using namespace std; int main()
{
long long int i,j; ///int会超
char s1[],s2[];
while(scanf("%s",s1)!=EOF)
{
scanf("%s",s2);
long len1=strlen(s1);
long len2=strlen(s2);
i=;
j=;
while(true)
{
if(i==len1)
{
cout<<"Yes"<<endl;
break;
}
else if(i<len1 && j==len2)
{
cout<<"No"<<endl;
break;
}
if(s1[i]==s2[j])
{
i++;
j++;
}
else
j++;
}
memset(s1,'\0',sizeof(s1));
memset(s2,'\0',sizeof(s2));
}
return ;
}
最新文章
- Loadrunner进行接口自动化测试
- 使用XSD校验Mybatis的SqlMapper配置文件(2)
- link them together by means of pointers
- call函数心得
- PHP JSON 操作总结
- linq中的GroupBy总结
- 201521123004 《Java程序设计》第1周学习总结
- Linux下Apache服务的查看和启动
- 基于springboot搭建的web系统架构
- tensorflow 经典教程及案例
- mysql集群搭建--韩国庆
- hdu-1115 计算几何 求重心 凸多边形 面积
- RabbitMQ学习笔记2-理解消息通信
- nohup和&; 区别
- LoadRunner做性能测试 从设计到分析执行
- IIS 7 反向代理 URL重写 转发动态请求
- 【转】VC++ 也有 Refactoring 功能了
- MySQL优化Explain命令简介(二)
- Linux 150命令之查看文件及内容处理命令 cat tac less head tail cut
- Alpha版发布 - 感谢有你们