codeforces 442 A. Alex and broken contest(水题)
来源:互联网 发布:苹果壁纸软件 编辑:程序博客网 时间:2024/06/04 23:01
【题解】
给定的串中只能含有五个字符串中的一个。
【AC代码】
#include<cstdio>#include<algorithm>#include<cstdio>#include<math.h>#include<string.h>#include<iostream>using namespace std;typedef __int64 ll;const int N = 2e5+10;int a[N],c[N];int m,n;char s[105];char str1[][8]={"Danil","Olya","Slava","Ann","Nikita"};int main(){ while( cin >> s) { m=0; for(int i=0;i<strlen(s);++i) { if(s[i] == 'D') { int x=0,k,j; for(j=i+1,k=1;j<=i+4;++j,++k) if(s[j] != str1[0][k]) break; if(k==5) m++; } else if(s[i] == 'O') { int x=0,k,j; for(j=i+1,k=1;j<=i+3;++j,++k) if(s[j] != str1[1][k]) break; if(k==4) m++; } else if(s[i] == 'S') { int x=0,k,j; for(j=i+1,k=1;j<=i+4;++j,++k) if(s[j] != str1[2][k]) break; if(k==5) m++; } else if(s[i] == 'A') { int x=0,k,j; for(j=i+1,k=1;j<=i+2;++j,++k) if(s[j] != str1[3][k]) break; if(k==3) m++; } else if(s[i] == 'N') { int x=0,k,j; for(j=i+1,k=1;j<=i+5;++j,++k) if(s[j] != str1[4][k]) break; if(k==6) m++; } } if(m==1) cout<<"YES\n"; else cout<<"NO\n"; } return 0;}
阅读全文
0 0
- codeforces 442 A. Alex and broken contest(水题)
- Codeforces 877 A Alex and broken contest
- Codeforces Round #442 (Div. 2) A. Alex and broken contest
- Codeforces Round #442 (Div. 2) A Alex and broken contest
- Codeforces Round #442 (Div. 2) A. Alex and broken contest
- Alex and broken contest Codeforces Round #442
- A. Alex and broken contest
- A. Alex and broken contest
- Codeforces Round #442 (Div. 2) A. Alex and broken contest,B
- CF#877 A. Alex and broken contest(KMP)
- [水题]Codeforces Round #307 (Div. 2) A.GukiZ and Contest
- CodeForces 551A GukiZ and Contest(模拟)
- Codeforces 501A:Contest(水题)
- CodeForces-551A GukiZ and Contest
- 【74.89%】【codeforces 551A】GukiZ and Contest
- codeforces 551A GukiZ and Contest
- CodeForces-722A. Broken Clock(模拟)
- Codeforces Round #357 (Div. 2) A Good Contest(水题)
- 文章标题
- 设计一个一元稀疏多项式简单的加减法计算器
- SEO在网页中的应用
- 关于\r和\n和\r\n
- 寻票软件医院挂号攻略
- codeforces 442 A. Alex and broken contest(水题)
- Linux多线程——使用信号量同步线程
- Java中连接Redis
- 链式队列
- Linux内核追踪[4.13] AIO的非阻塞优化
- 谷歌浏览器设置百度搜索为默认搜索引擎后,出现ask.com
- C++中输入流istream
- 串口数据接收LCD液晶显示
- 模型评估:评价指标-附sklearn API