Alex and broken contest CodeForces - 877A
/*
Name:
Copyright:
Author:
Date: 2018/5/2 10:45:16
Description:
要求出现一个朋友的名字,仅一次
*/
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
int main()
{
// freopen("in.txt", "r", stdin);
string fname1 = "Danil";
string fname2 = "Olya";
string fname3 = "Slava";
string fname4 = "Nikita";
string fname5 = "Ann";
string str;
while (cin>>str) {
int flag = ;
if (str.find(fname1) != -) {
int pos = ;
string tmp = str;
while ((pos = tmp.find(fname1)) != -) {
flag ++;
tmp = tmp.substr(pos + );
if (flag >= ) break;
}
}
if (str.find(fname2) != -) {
int pos = ;
string tmp = str;
while ((pos = tmp.find(fname2)) != -) {
flag ++;
tmp = tmp.substr(pos + );
if (flag >= ) break;
}
}
if (str.find(fname3) != -) {
int pos = ;
string tmp = str;
while ((pos = tmp.find(fname3)) != -) {
flag ++;
tmp = tmp.substr(pos + );
if (flag >= ) break;
}
}
if (str.find(fname4) != -) {
int pos = ;
string tmp = str;
while ((pos = tmp.find(fname4)) != -) {
flag ++;
tmp = tmp.substr(pos + );
if (flag >= ) break;
}
}
if (str.find(fname5) != -) {
int pos = ;
string tmp = str;
while ((pos = tmp.find(fname5)) != -) {
flag ++;
tmp = tmp.substr(pos + );
if (flag >= ) break;
}
}
if (flag == ) {
cout<<"YES"<<endl;
} else {
cout<<"NO"<<endl;
}
}
return ;
}
Alex and broken contest CodeForces - 877A的更多相关文章
- Codeforces Round #442 A Alex and broken contest【字符串/常量数组/string类】
A. Alex and broken contest time limit per test 2 seconds memory limit per test 256 megabytes input s ...
- 【Codeforces Round #442 (Div. 2) A】Alex and broken contest
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 注意是所有的名字里面,只出现了其中某一个名字一次. [代码] #include <bits/stdc++.h> usin ...
- Broken BST CodeForces - 797D
Broken BST CodeForces - 797D 题意:给定一棵任意的树,对树上所有结点的权值运行给定的算法(二叉查找树的查找算法)(treenode指根结点),问对于多少个权值这个算法会返回 ...
- The Contest CodeForces - 813A (思维)
Pasha is participating in a contest on one well-known website. This time he wants to win the contest ...
- AC日记——Broken BST codeforces 797d
D - Broken BST 思路: 二叉搜索树: 它时间很优是因为每次都能把区间缩减为原来的一半: 所以,我们每次都缩减权值区间. 然后判断dis[now]是否在区间中: 代码: #include ...
- Broken robot CodeForces - 24D (概率DP)
You received as a gift a very clever robot walking on a rectangular board. Unfortunately, you unders ...
- 2016-2017 National Taiwan University World Final Team Selection Contest (Codeforces Gym) 部分题解
D 考虑每个点被删除时其他点对它的贡献,然后发现要求出距离为1~k的点对有多少个. 树分治+FFT.分治时把所有点放一起做一遍FFT,然后减去把每棵子树单独做FFT求出来的值. 复杂度$nlog^ ...
- 2018-2019 ICPC, NEERC, Southern Subregional Contest (codeforces 1070)
A. 直接从状态(0,0)bfs, 这样一定是最小的 #include <iostream> #include <sstream> #include <algorithm ...
- Broken robot CodeForces - 24D (三对角矩阵简化高斯消元+概率dp)
题意: 有一个N行M列的矩阵,机器人最初位于第i行和第j列.然后,机器人可以在每一步都转到另一个单元.目的是转到最底部(第N个)行.机器人可以停留在当前单元格处,向左移动,向右移动或移动到当前位置下方 ...
随机推荐
- STL之空间配置器
在前面很多随笔里都有提到new对象是先分配内存然后初始化对象,主要是对operator new和placement new的使用 在SGI STL中内存的分配和初始化是分开的,分配内存是使用类模板,模 ...
- boost之正确性和测试
BOOST_ASSERT在debug模式下有效. #include <iostream> #include <boost/assert.hpp> using namespace ...
- oracle11g参数的简单查看方法
1.查看processes和sessions参数show parameter processesshow parameter sessions 2.修改processes和sessions值alter ...
- IIS 6.0上部署.NET 4.0网站
最近需要把VS2010开发的网站部署到Windows Server 2003的服务器上去, Windows Server 2003操作系统自带的为IIS 6.0,IIS 6.0一般只支持.NET 2. ...
- 小计---pandas读取带有中文文件名或者包含中文内容的文件
python2下: # -*- coding: utf-8 -*- import pandas as pd mydata = pd.read_csv(u"例子.csv") #前面加 ...
- C#加快Bitmap的访问速度
在对Bitmap图片操作的时候,有时需要用到获取或设置像素颜色方法:GetPixel 和 SetPixel, 如果直接对这两个方法进行操作的话速度很慢,这里我们可以通过把数据提取出来操作,然后操作完在 ...
- 【整理学习Hadoop】Hadoop学习基础之二:分布式
分布式系统就是将系统的应用层,数据层或其它部分构架成分布(物理和逻辑上的都可以)状(通常是网状).分布式系统通常是为了增强系统的可扩展性.稳定性和执行效率.比如在线游戏通常就是分布系统,里面所谓的 ...
- Service Fusing
服务熔断也称服务隔离,来自于Michael Nygard 的<Release It>中的CircuitBreaker应用模式,Martin Fowler在博文CircuitBreaker中 ...
- window端口号被占用解决
1. 找到占用该端口的pid netstat -ano|findstr "端口号" 2. 强制关闭该占用该端口的进程 // 关闭 taskkill -pid 刚才查的pid // ...
- Adding Flexcan driver support on Kernel
Adding Flexcan driver support on Kernel On kernel menuconfig, add the following items: [*] Networkin ...