CodeForces
来源:互联网 发布:Linux web根目录 编辑:程序博客网 时间:2024/06/05 10:29
Alex and broken contest
One day Alex was creating a contest about his friends, but accidentally deleted it. Fortunately, all the problems were saved, but now he needs to find them among other problems.But there are too many problems, to do it manually. Alex asks you to write a program, which will determine if a problem is from this contest by its name.It is known, that problem is from this contest if and only if its name contains one of Alex's friends' name exactly once. His friends' names are "Danil", "Olya", "Slava", "Ann" and "Nikita".Names are case sensitive.
Input
The only line contains string from lowercase and uppercase letters and "_" symbols of length, not more than 100 — the name of the problem.
Output
Print "YES", if problem is from this contest, and "NO" otherwise.
Example
Input
Alex_and_broken_contestOutputNOInputNikitaAndStringOutputYESInputDanil_and_OlyaOutputNO
#include<bits/stdc++.h>using namespace std;char name[130];int ok=0;char a[]={"Danil"};char b[]={"Olya"};char c[]={"Slava"};char d[]={"Ann"};char e[]={"Nikita"};void isfri(char x[]){int n=strlen(name);int m=strlen(x);for(int i=0;i<=n-m;i++){ int j; for(j=0;j<m;j++) if(name[i+j]!=x[j]) break; if(j==m) ok++;}}int main(){ scanf("%s",&name); isfri(a);isfri(b);isfri(c);isfri(d);isfri(e); if(ok==1) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
阅读全文
0 0
- codeforces~~~
- Codeforces
- codeforces
- Codeforces
- codeforces
- codeforces
- Codeforces
- Codeforces
- CodeForces
- CodeForces
- CodeForces
- CodeForces
- CodeForces
- Codeforces
- Codeforces
- Codeforces
- Codeforces
- Codeforces
- android开发中那些掉过的坑(持续更新)
- VTK的安装配置(一)——使用vs2015,QT5.9
- Make构建工具快速入门及应用
- 五步搞定Android开发环境部署!
- 题
- CodeForces
- ETH挖矿【解决A卡DAG掉算力教程】
- 关于Java数据库中的一点小知识
- bitmap
- 图——哈夫曼编码
- 7-3 jmu-ds-单链表的基本运算
- 关于webview中的H5微信支付返回白屏的
- python-bool
- Tmux 终端命令行介绍