cf B. Dima and Text Messages
http://codeforces.com/contest/358/problem/B
先按照题意说的构造一个字符串s,然后与对比的字符串T比较,看看在字符串T中顺序查找有没有字符串S的所有字符,有输出yes,否则输出no.
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std; char str[],s[];
int n; int main()
{
while(scanf("%d",&n)!=EOF)
{
int cnt;
s[]='<';
s[]='';
cnt=;
for(int i=; i<=n; i++)
{
scanf("%s",str);
for(int j=; j<(int)strlen(str); j++)
{
s[cnt++]=str[j];
}
s[cnt++]='<';
s[cnt++]='';
}
scanf("%s",str);
int k=;
for(int j=; j<(int)strlen(str); j++)
{
if(s[k]==str[j])
{
k++;
}
}
if(k==cnt)
{
printf("yes\n");
}
else printf("no\n");
}
return ;
}
cf B. Dima and Text Messages的更多相关文章
- codeforces B. Dima and Text Messages 解题报告
题目链接:http://codeforces.com/problemset/problem/358/B 题目意思:给出n个单词(假设为word1,word2.word3...wordn)和一句test ...
- Codeforces Round #208 (Div. 2) B Dima and Text Messages
#include <iostream> #include <algorithm> #include <string> using namespace std; in ...
- cf D. Dima and Trap Graph
http://codeforces.com/contest/366/problem/D 遍历下界,然后用二分求上界,然后用dfs去判断是否可以. #include <cstdio> #in ...
- CF 366E Dima and Magic Guitar(最远哈密顿距离)
题目链接:http://codeforces.com/problemset/problem/366/E 题意:给出一个n*m的数字矩阵A,每个矩阵元素的范围[1,K].给出一个长度为s的数字串B,B的 ...
- cf E. Dima and Magic Guitar
http://codeforces.com/contest/366/problem/E |x1-x2|+|y1-y2|有四种情况 1.-(x1-x2)+(y1-y2); 2.(x1-x2)-(y1-y ...
- cf C. Dima and Salad
http://codeforces.com/contest/366/problem/C 转化为背包问题,可以将a[i]-b[i]*k看成重量,a[i]为价值: 因为a[i]-b[i]*k可以为负数,所 ...
- cf B. Dima and To-do List
http://codeforces.com/contest/366/problem/B 从0到k枚举起点,然后i+k判断是不是i+k>=n如果是i=(i+k)%n;否则i=i+k; #inclu ...
- cf D. Dima and Hares
http://codeforces.com/contest/358/problem/D 题意:ai代表相邻的两个野兔都没有吃食物情况下的快乐系数,bi代表的是在相邻的两个野兔中有一个吃到食物的快乐系数 ...
- cf C. Dima and Containers
http://codeforces.com/contest/358/problem/C 将最大的放在stack里面,第二大的放在queue中,第三大的放在deck里面.然后模拟就可以了. #inclu ...
随机推荐
- 嵌入式linux内核制作
今天来总结一下mini2440的内核制作过程. 一. 将内核文件拷贝至目标目录,解压. 二.清除中间文件 命令:make distclean 三.配置内核文件 将开发板厂商制作好的内核文件拷贝至内核文 ...
- Palindrome Pairs 解答
Question Given a list of unique words, find all pairs of distinct indices (i, j) in the given list, ...
- RSA算法python实现
RSA算法是一种非对称加密算法,是现在广泛使用的公钥加密算法,主要应用是加密信息和数字签名.详情请看维基:http://zh.wikipedia.org/wiki/RSA%E5%8A%A0%E5%AF ...
- (转)苹果消息推送服务器 php 证书生成
1.准备好 aps_developer_identity.cer , push.p12这两个证书文件 2. 生成证书如下: openssl x509 -in aps_developer_identit ...
- 关于url路径的定义方式
一.概述 无论是做网页,还是WEB系统,我们都会用到链接,图片,文件的地方,这些地方都涉及到路径的问题,例如:background-image:url();这一CSS样式,而url()的定义方式有两种 ...
- Android Fragment详解(一):概述
Fragment是activity的界面中的一部分或一种行为.你可以把多个Fragment们组合到一个activity中来创建一个多面界面并且你可以在多个activity中重用一个Fragment.你 ...
- MySQL数据库中的哈希加密
数据库安全是数据库中最为重要的环节,只有确保了数据库中数据的安全,才能够更好的发挥数据库的功能,本文将为大家介绍一种很好的数据库加密方法,即哈希加密. 导读:MySQL数据库加密的方法有很多种,不同的 ...
- C复习手记(Day4)
1.C错误处理 errno.perror() 和sterror() perror() 函数显示您传给它的字符串,后跟一个冒号.一个空格和当前 errno 值的文本表示形式. strerror() 函数 ...
- HTML5框架、背景和实体、XHTML的使用规范
HTML5框架 cols :竖排 rows:横排,frameset frame已弃用 iframe仍保留使用.用法: Target属性: HTML5实体 XHTML的使用规范
- SQL从入门到基础 - 05 数据分组、Having语句
一.数据分组 1. 按照年龄进行分组统计各个年龄段的人数: Select FAge,count(*) from T_Employee group by FAge; 2. Group by子句必须放到w ...