BC一周年B
来源:互联网 发布:剪切合并音乐软件 编辑:程序博客网 时间:2024/05/17 22:00
#include <cstdio>#include <iostream>#include <algorithm>#include <queue>#include <cmath>#include <cstring>#include <stack>#include <set>#include <map>#include <vector>using namespace std;#define INF 0x4fffffff#define LL long long#define MAX(a,b) ((a)>(b))?(a):(b)#define MIN(a,b) ((a)<(b))?(a):(b)char str[] = "anniversary";int a[300][4] = {};char st[105];int main(){ int t; cin >> t; int len = strlen(str); int w = 0; for(int i = 0;i < len-2;i++){ for(int j = i+1;j < len-1;j++){ a[w][0] = i; a[w][1] = j; a[w][2] = len-1; w++; } } while(t--){ scanf("%s",st); len = strlen(st); int flag = 0; int s,e,g,f; for(int i = 0;i < w;i++){ s = 0; f = 0; g = 0; for(int j = 0;j < 3;j++){ e = a[i][j]; for(int k = g;k < len;k++){ int d = 0; int status = 0; while(str[s+d] == st[k+d] && s+d <= e && k+d < len){ if(s+d == e){ f ++; s = a[i][j]+1; g = k+d+1; status = 1; break; } d ++; } if(status){ break; } } } if(f == 3){ flag = 1; break; } } if(flag){ printf("YES\n"); } else{ printf("NO\n"); } } return 0;}
0 0
- BC一周年B
- BC一周年A
- BC俩周年 Oracle
- 一周年
- 一周年
- 一周年
- 一周年
- 一周年
- 一周年
- BC #65(B) 规律
- 到职一周年,EIAC项目一周年
- BC#59 (div.2) B
- BC 62 (div.2) B
- BenQ一周年记
- 毕业一周年祭奠
- 毕业一周年随想
- 纪工作一周年
- blog一周年记
- 第一篇Java概述及环境变量搭配
- java获取当前运行路径
- Leetcode #54 Spiral Matrix
- kettle(一)概述
- Souvenir
- BC一周年B
- 理解二级指针
- java web项目中将数据库从SQL Server转为Access出现的常见错误
- ora-01036: 非法的变量名/编号
- windows7环境下theano安装
- BC一周年A
- poj 3648 Wedding 【2-sat 经典建图 输出一组可行解 好题】 【tarjan求SCC + 缩点 + 拓扑排序 + 染色】
- C++学习,总结一
- laravel实用笔记