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个)行.机器人可以停留在当前单元格处,向左移动,向右移动或移动到当前位置下方 ...
随机推荐
- 4.6 基于STM32+MC20地图显示路径功能
需要准备的硬件 MC20开发板 1个 https://item.taobao.com/item.htm?id=562661881042 GSM/GPRS天线 1根 https://item.taoba ...
- Sourse Insight使用教程及常见的问题解决办法
1.下载安装 2.创建项目new project(注意不是file-->new ),而是project-->new project,输入项目名称和密码. 3.添加文件,其实就是将你的整个项 ...
- window.name跨域
window.name? 每一个页面都有一个自己的window,而window.name是window的名字. window.name跨域原理 window对象有个name属性,该属性有个特征:即在一 ...
- python 运行报错 Process finished with exit code -1073741819 (0xC0000005)
发现是由于openpyxl模块导致的,去掉这个模块的内容就能运行,import openpyxl就运行不起来, 将openpyxl卸载了重装, 以及更换了不同的openpyxl版本,都不行,还是运行不 ...
- INSPIRED启示录 读书笔记 - 第35章 情感接纳曲线
技术接纳曲线 涉及了技术创新者.尝鲜者.早期消费大众.后期消费大众和跟随者,很少有产品能越过鸿沟——获得尝鲜者以外消费者的青睐 不同类型的用户具有不同的情感需求,除了技术接纳曲线模型描述用户外,还应该 ...
- 如何在Eclipse环境下安装PyDev并成功运行Python3.6代码
准备条件: 事先安装好了Eclipse 软件 Python3.6解释器也安装好了 安装PyDev ① 打开Eclipse,到help -> Eclipse markplace 找到PyDev - ...
- JSP 导出Excel表格
ES6语法 传入一个table的id,然后在导出excel按钮上加入一个<a href="#" id="buttonId">导出Excel</ ...
- java.lang.NullPointerException报错的几种情况
java.lang.NullPointerException报错的几种情况: 1.字符串变量未初始化: 2.接口类型的对象没有用具体的类初始化,比如: List stuList :这种情况就会报空指针 ...
- 电子商务的几种模式,b2b,c2c等
B2B(Business to Business) ——这是指商家与商家建立的商业关系.(最早的一种模式) C2C (Customer to Consumer) ——个人与个人的商业关系,也就是消费者 ...
- ambari2.4.2在CentOS7上的二次开发
前言:如果想安装到CentOS7,就一定要将源码在CentOS7上编译,然后安装,否则可能会出现各种问题 目录 源码结构 技术点 编译环境的搭建 安装samba 安装编译环境 整体编译 ambari ...