/*
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的更多相关文章

  1. 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 ...

  2. 【Codeforces Round #442 (Div. 2) A】Alex and broken contest

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 注意是所有的名字里面,只出现了其中某一个名字一次. [代码] #include <bits/stdc++.h> usin ...

  3. Broken BST CodeForces - 797D

    Broken BST CodeForces - 797D 题意:给定一棵任意的树,对树上所有结点的权值运行给定的算法(二叉查找树的查找算法)(treenode指根结点),问对于多少个权值这个算法会返回 ...

  4. The Contest CodeForces - 813A (思维)

    Pasha is participating in a contest on one well-known website. This time he wants to win the contest ...

  5. AC日记——Broken BST codeforces 797d

    D - Broken BST 思路: 二叉搜索树: 它时间很优是因为每次都能把区间缩减为原来的一半: 所以,我们每次都缩减权值区间. 然后判断dis[now]是否在区间中: 代码: #include ...

  6. Broken robot CodeForces - 24D (概率DP)

    You received as a gift a very clever robot walking on a rectangular board. Unfortunately, you unders ...

  7. 2016-2017 National Taiwan University World Final Team Selection Contest (Codeforces Gym) 部分题解

      D 考虑每个点被删除时其他点对它的贡献,然后发现要求出距离为1~k的点对有多少个. 树分治+FFT.分治时把所有点放一起做一遍FFT,然后减去把每棵子树单独做FFT求出来的值. 复杂度$nlog^ ...

  8. 2018-2019 ICPC, NEERC, Southern Subregional Contest (codeforces 1070)

    A. 直接从状态(0,0)bfs, 这样一定是最小的 #include <iostream> #include <sstream> #include <algorithm ...

  9. Broken robot CodeForces - 24D (三对角矩阵简化高斯消元+概率dp)

    题意: 有一个N行M列的矩阵,机器人最初位于第i行和第j列.然后,机器人可以在每一步都转到另一个单元.目的是转到最底部(第N个)行.机器人可以停留在当前单元格处,向左移动,向右移动或移动到当前位置下方 ...

随机推荐

  1. centos中搭建nginx环境

    原文地址 安装PCRE 源码:ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ cd /usr/local/src wget ftp://f ...

  2. 前端基础之JavaScript_(3)_DOM对象

    JavaScript之DOM对象 HTML  DOM HTML  Document Object Model(文档对象模型) HTML DOM 定义了访问和操作HTML文档的标准方法 HTML DOM ...

  3. tar软件安装

    安装tar   ./configure   make   sudo make install

  4. JQuery 获取父元素方法

    ---恢复内容开始--- <tr class="removerow" style=""> <td> <input type=&qu ...

  5. $git学习总结系列(2)——远程仓库

    本文主要介绍git本地仓库和GitHub远程仓库之间的交互和数据传输. 注:首先需要到github.com上注册一个账号. 1. 添加本地SSH Key到GitHub 要向GitHub远程仓库推送代码 ...

  6. webAPI支持跨域

    问题描述: 添加引用:右键项目→添加nuget包 在:App_Start/WebApiConfig.Register中添加如下一句话 //跨域配置 config.EnableCors(new Enab ...

  7. rsh命令配置于使用

    安装环境:一台centos6.10虚拟机,一台centos7.5虚拟机,全部使用root用户登录. 两台机器上都要安装rsh.rsh-server.xinetd包. 两台机器都要关闭防火墙并配置/et ...

  8. LVS 介绍

    LVS 介绍 说明: LVS是Linux Virtual Server的简称 LVS是一个实现负载均衡的开源软件项目 LVS效率要高于Nginx LVS工作在ISO的第4层(传输层) LVS架构有三层 ...

  9. CCNA 课程 七

    WAN(Wide Area Network)广域网 运行在OSI模型的数据链路层.物理层. 数据链路层的协议主要有: HDLC  (High-Level Data Link Control 高级数据链 ...

  10. WebUploader API文档

    Web Uploader内部类的详细说明,以下提及的功能类,都可以在WebUploader这个变量中访问到. As you know, Web Uploader的每个文件都是用过AMD规范中的defi ...