結果

問題 No.290 1010
ユーザー fushime2
提出日時 2018-01-10 15:59:28
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 6 ms / 5,000 ms
コード長 358 bytes
コンパイル時間 1,719 ms
コンパイル使用メモリ 158,300 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-23 15:38:04
合計ジャッジ時間 2,171 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
main.cpp:9:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |     scanf("%s", s);
      |     ~~~~~^~~~~~~~~

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

int n;
char s[1000010];

int main() {
    scanf("%d", &n);
    scanf("%s", s);
    if (n < 3) {
        puts(n == 1 ? "NO" : s[0] == s[1] ? "YES" : "NO");
        return 0;
    }

    if (n == 3) {
        puts(s[0]==s[1] || s[1]==s[2] ? "YES" : "NO");
        return 0;
    }

    puts("YES");
    return 0;
}
0