zoukankan      html  css  js  c++  java
  • Codeforces 989A: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.

    题意:找一个字符串中是否有连续的三个字符,这三个字符都不相等,且不为"."//

    //WA了好多发都是因为大意,没仔细读写好的代码,难受

    #include <bits/stdc++.h>
    using namespace std;
    const int maxn=1000;
    char ch[maxn];
    int main(int argc, char const *argv[])
    {
    	cin>>ch;
    	int l=strlen(ch);
    	int flag=0;
    	for(int i=0;i<l-2;i++)
    	{
    		if(ch[i]!=ch[i+1]&&ch[i+1]!=ch[i+2]&&ch[i+2]!=ch[i]&&ch[i]!='.'&&ch[i+1]!='.'&&ch[i+2]!='.')
    			flag++;
    	}
    	if(flag)
    		cout<<"Yes"<<endl;
    	else
    		cout<<"No"<<endl;
    	return 0;
    }
  • 相关阅读:
    FMDB(一)— 简单介绍
    产品设计之设计理念
    整理了一下浅墨大神的Visual C++/DirectX 9.0c的游戏开发手记
    使用scp免passwordserver间传递文件
    游戏架构其一:经常使用工具集合
    Failed to import package with error: Couldn't decompress package
    【从0開始Tornado建站】0.9版本号python站点代码开源--持续更新中
    【Android】 给我一个Path,还你一个酷炫动画
    codeforces Round #Pi (div.2) 567ABCD
    linux 查看磁盘使用情况
  • 原文地址:https://www.cnblogs.com/Friends-A/p/9308994.html
Copyright © 2011-2022 走看看