美文网首页
CodeFoeces-989A

CodeFoeces-989A

作者: ss5smi | 来源:发表于2018-06-12 18:07 被阅读0次

题目

原题链接:A. A Blend of Springtime

题意

给出一串由'.'、'A'、'B'、'C'组成的字符串,问有没有连续三个不同字符的情况,不包括'.'。

代码

#include<bits/stdc++.h>
using namespace std;
int main() {
    string s;
    cin>>s;
    int l = s.length();
    int flag = 0;
    for(int i=0;i<l;i++){
        if(s[i]+s[i+1]+s[i+2] == 198 && s[i]!=s[i+1] && s[i]!=s[i+2]){
            flag = 1;
        }
    }   
    printf("%s\n",flag?"YES":"NO");
    return 0;
}

相关文章

  • CodeFoeces-989A

    题目 原题链接:A. A Blend of Springtime 题意 给出一串由'.'、'A'、'B'、'C'组...

网友评论

      本文标题:CodeFoeces-989A

      本文链接:https://www.haomeiwen.com/subject/jycreftx.html