結果
| 問題 | No.290 1010 | 
| コンテスト | |
| ユーザー |  hiro71687k | 
| 提出日時 | 2023-03-19 15:09:22 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 21 ms / 5,000 ms | 
| コード長 | 794 bytes | 
| コンパイル時間 | 3,456 ms | 
| コンパイル使用メモリ | 249,832 KB | 
| 最終ジャッジ日時 | 2025-02-11 15:22:51 | 
| ジャッジサーバーID (参考情報) | judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 24 | 
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll inf=1444440099999944;
ll mod=1000000007;
int main(){
    ll n;
    cin >> n;
    string s;
    cin >> s;
    if (n>=4)
    {
        cout << "YES" << endl;
    }else{
        if (n==1)
        {
            cout << "NO" << endl;
        }else if (n==2)
        {
            if (s[0]==s[1])
            {
                cout << "YES" << endl;
            }else{
                cout << "NO" << endl;
            }
        }else{
            if (s[0]==s[2]&&s[0]!=s[1])
            {
                cout << "NO" << endl;
            }else{
                cout << "YES" << endl;
            }
            
        }
    }
    
}
            
            
            
        