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 ...
随机推荐
- B450配置
电脑型号 联想 B450 笔记本电脑 (扫描时间:2015?5?7?操作系统 Windows 7 旗舰版 32位 SP1 ( DirectX 11 ) 处理器 英特尔 酷睿2 双核 T9800 @ ...
- Design Tic-Tac-Toe 解答
Question Design a Tic-tac-toe game that is played between two players on a n x n grid. You may assum ...
- [LeetCode] 110. Balanced Binary Tree 解题思路
Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary ...
- POJ-1028(字符串模拟)
Web Navigation Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 31906 Accepted: 14242 ...
- squid 代理服务器安装配置
ubuntu16.04 安装squid代理服务器配置 本文参考 http://www.cnblogs.com/newflypig/archive/2012/09/28/2862000.html 1,删 ...
- lesson8:AtomicInteger源码解析及性能分析
AtomicInteger等对象出现的目的主要是为了解决在多线程环境下变量计数的问题,例如常用的i++,i--操作,它们不是线程安全的,AtomicInteger引入后,就不必在进行i++和i--操作 ...
- 使用CXF+spring创建一个web的接口项目
一.web project整合spring 1.1.打开Myeclipse,建立web project(eclipse为dynamic web project),使用J2EE5.0. 1.2.加入Sr ...
- jsPlumb开发入门教程(实现html5拖拽连线)
jsPlumb是一个强大的JavaScript连线库,它可以将html中的元素用箭头.曲线.直线等连接起来,适用于开发Web上的图表.建模工具等.它同时支持jQuery+jQuery UI.MooTo ...
- 重学《C#高级编程》(继承)
前两天重新看了<C#高级编程>里的第四章:继承与第六章:数组.OOP三大特性:封装,继承,多态,个人感觉继承是实现多态的基础,包括以后接触的设计模式,都是继承特性的衍生. 继承特性有两种, ...
- web前端之文件上传
前言 最近太忙一直没时间认真的写博客(哈哈哈),最近pm提一个需求,移动端需要一个上传图片的功能,允许多选.删除.预览.点击查看大图并可以滑动.虽然听起来很多,但是这个功能在web上实现过啊,使用we ...