Codeforces Round #487 (Div. 2) ---A.A Blend of Springtime
A. A Blend of Springtime
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
题目链接
When the curtains are opened, a canvas unfolds outside. Kanno marvels at all the blonde colours along the riverside — not tangerines, but blossoms instead.
"What a pity it's already late spring," sighs Mino with regret, "one more drizzling night and they'd be gone."
"But these blends are at their best, aren't they?" Absorbed in the landscape, Kanno remains optimistic.
The landscape can be expressed as a row of consecutive cells, each of which either contains a flower of colour amber or buff or canary yellow, or is empty.
When a flower withers, it disappears from the cell that it originally belonged to, and it spreads petals of its colour in its two neighbouring cells (or outside the field if the cell is on the side of the landscape). In case petals fall outside the given cells, they simply become invisible.
You are to help Kanno determine whether it's possible that after some (possibly none or all) flowers shed their petals, at least one of the cells contains all three colours, considering both petals and flowers. Note that flowers can wither in arbitrary order.
Input
The first and only line of input contains a non-empty string ss consisting of uppercase English letters 'A', 'B', 'C' and characters '.' (dots) only (|s|≤100|s|≤100) — denoting cells containing an amber flower, a buff one, a canary yellow one, and no flowers, respectively.
Output
Output "Yes" if it's possible that all three colours appear in some cell, and "No" otherwise.
You can print each letter in any case (upper or lower).
Examples
input
Copy
.BAC.
output
Copy
Yes
input
Copy
AA..CB
output
Copy
No
Note
In the first example, the buff and canary yellow flowers can leave their petals in the central cell, blending all three colours in it.
In the second example, it's impossible to satisfy the requirement because there is no way that amber and buff meet in any cell.
这道题目看懂题目意思便很简单,其实就是输入一段字符串,判断在这个字符串里面是否存在A,B,C连在一起,直接便利一遍便可以只要一个s[i],s[i-1],s[i+1]不相等且都等于‘.’便符合条件
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
const int maxn=1e9+7;
string s;
int main(int argc,char *argv[]){/* #ifdef LOCALfreopen("C:/Users/Administrator/Desktop/input.txt","r",stdin);#endif*/cin>>s;int flag=0;for(int i=1;i<s.size()-1;i++){if(s[i]!='.'){if(s[i-1]!=s[i]&&s[i+1]!=s[i]&&s[i+1]!=s[i-1]&&s[i+1]!='.'&&s[i-1]!='.'){flag=1;break;}}}if(flag)cout<<"Yes"<<endl;else cout<<"No"<<endl;return 0;
}
Codeforces Round #487 (Div. 2) ---A.A Blend of Springtime相关推荐
- Codeforces Round #506 (Div. 3)
Codeforces Round #506 (Div. 3) 实习期间事不多,对div3 面向题解和数据编程了一波 A. Many Equal Substrings 题目链接 A题就是找后缀和前缀重合 ...
- Codeforces Round #563 (Div. 2)/CF1174
Codeforces Round #563 (Div. 2)/CF1174 CF1174A Ehab Fails to Be Thanos 其实就是要\(\sum\limits_{i=1}^n a_i ...
- 构造 Codeforces Round #302 (Div. 2) B Sea and Islands
题目传送门 1 /* 2 题意:在n^n的海洋里是否有k块陆地 3 构造算法:按奇偶性来判断,k小于等于所有点数的一半,交叉输出L/S 4 输出完k个L后,之后全部输出S:) 5 5 10 的例子可以 ...
- Codeforces Round #696 (Div. 2) (A ~ E)超高质量题解(每日训练 Day.16 )
整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 Codeforces Round #696 (Div. 2) (A ~ E)超高质量题解 比赛链接:h ...
- Codeforces Round #712 Div.2(A ~ F) 超高质量题解(每日训练 Day.15 )
整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 Codeforces Round #712 Div.2(A ~ F) 题解 比赛链接:https:// ...
- Codeforces Round #701 (Div. 2) A ~ F ,6题全,超高质量良心题解【每日亿题】2021/2/13
整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 目录 A - Add and Divide B - Replace and Keep Sorted C ...
- Codeforces Round #700 (Div. 2) D2 Painting the Array II(最通俗易懂的贪心策略讲解)看不懂来打我 ~
整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 整场比赛的A ~ E 6题全,全部题目超高质量题解链接: Codeforces Round #700 ...
- Codeforces Round #699 (Div. 2) F - AB Tree(贪心、树上DP)超级清晰,良心题解,看不懂来打我 ~
整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 Codeforces Round #699 (Div. 2) F - AB Tree Problem ...
- Codeforces Round #699 (Div. 2) (A ~ F)6题全,超高质量良心题解【每日亿题】2021/2/6
整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 Codeforces Round #699 (Div. 2) (A.B.C)[每日亿题]2021/2/ ...
最新文章
- linux系统中文件编程,Linux当中的文件系统
- GDCM:gdcm::Orientation的测试程序
- css鼠标悬停样式_利用Css3样式属性Cursor来更换自定义个性化鼠标指针(光标
- npm收录了哪些包_手把手教你制作一个小而美丽的 npm 包并发布
- 计算机专业方面的期刊介绍
- sterm机器人编程_STEAM智能编程机器人
- 列联表与独立性检验(一维列联表 二维列联表 三维列联表 ; 卡方检验 Fisher精确检验 Cochran-Mantel-Haenszel检验)
- 7月18日云栖精选夜读丨蚂蚁金服的“野心”:要做新一代世界级金融科技供应商...
- 1. 2020年《DeepMind&UCL深度学习讲座》第1讲:机器学习和AI入门【中文字幕】
- 网络编程学习_TCP协议
- 经典合成器和键盘合集-Arturia V Collection 7 v7.1.2 WiN
- 还在调API写所谓的AI“女友”,唠了唠了,教你基于python咱们“new”一个(深度学习)
- #有关汇编语言的org指令(许多不为人知的故事):
- html在线预览ppt excel,JavaScript实现Word、Excel、PPT在线预览
- 英雄会第一届在线编程大赛解题思路
- 因为意外的遇到文件尾,PS无法打开怎么办?
- 全国首个海洋大数据交易服务平台交易额破百万
- html5 便签墙,自己制作画毡墙
- 极空间家庭私有云,您的数字资产大管家
- iCloud中的照片如何导出到个人电脑中进行储存?