/*
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. boost之智能指针

    内存问题永远是c++中讨论的重要话题 1.c98 auto_ptr的实现,auto_ptr的特点是始终只保持一个指针指向对象,若经过赋值或者拷贝之后原指针失效 #include <iostrea ...

  2. LeetCode-day03

    28. Best Time to Buy and Sell Stock 买卖股票的最好时间 29. Best Time to Buy and Sell Stock II 买卖股票2(多次买入,一次卖出 ...

  3. 爬虫基础库之Selenium

    1.简介 selenium最初是一个自动化测试工具,而爬虫中使用它主要是为了解决requests无法直接执行JavaScript代码的问题 selenium本质是通过驱动浏览器,完全模拟浏览器的操作, ...

  4. Spring Boot之AOP面向切面编程-实战篇

    目录 前言 编程范式主要有以下几类 引入pom依赖 aop注解 实现日志分割功能 前言 AOP是一种与语言无关的程序思想.编程范式.项目业务逻辑中,将通用的模块以水平切割的方式进行分离统一处理,常用于 ...

  5. MySQL数据库(4)_MySQL数据库外键约束、表查询

    一.外键约束 创建外键 --- 每一个班主任会对应多个学生 , 而每个学生只能对应一个班主任 ----主表 CREATE TABLE ClassCharger( id TINYINT PRIMARY ...

  6. asp.net 利用Response.Filter 获取输出内容, 变更输出内容

    重写 Response.Filter 就可以获取或更新输出到浏览器的内容       资料: https://weblog.west-wind.com/posts/2009/Nov/13/Captur ...

  7. Python学习进程(8)字符串內建函数

        Python字符串內建函数实现了string模块的大部分方法,并包括了对Unicode编码方式的支持.     (1)capitalize(): 将字符串的第一个字母变成大写,其他字母变小写. ...

  8. 网络:W5500抓包TCP segment of a reassembled PDU

    1.问题描述 W5500 http测试,用wireshark抓包,发现出现很多TCP segment of a reassembled PD. 2. 问题分析 TCP segment of a rea ...

  9. 无线路由:关于WDS,Repeater等模式的说明

    转:http://blog.csdn.net/lizhiqiang5846/article/details/38397803 当今如果不用无线路由连接宽带似乎是很不popular了,当然Wifi/WL ...

  10. 【Flask】Sqlalchemy lazy

    ### 懒加载:在一对多,或者多对多的时候,如果想要获取多的这一部分的数据的时候,往往能通过一个属性就可以全部获取了.比如有一个作者,想要或者这个作者的所有文章,那么可以通过user.articles ...