結果

問題 No.290 1010
ユーザー htensaihtensai
提出日時 2019-12-18 12:00:02
言語 Java21
(openjdk 21)
結果
AC  
実行時間 141 ms / 5,000 ms
コード長 622 bytes
コンパイル時間 2,896 ms
コンパイル使用メモリ 72,180 KB
実行使用メモリ 54,296 KB
最終ジャッジ日時 2023-09-20 08:45:55
合計ジャッジ時間 4,808 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
47,664 KB
testcase_01 AC 44 ms
49,124 KB
testcase_02 AC 43 ms
49,176 KB
testcase_03 AC 44 ms
49,172 KB
testcase_04 AC 44 ms
49,176 KB
testcase_05 AC 44 ms
49,140 KB
testcase_06 AC 44 ms
49,240 KB
testcase_07 AC 43 ms
49,168 KB
testcase_08 AC 44 ms
49,456 KB
testcase_09 AC 44 ms
49,124 KB
testcase_10 AC 43 ms
49,148 KB
testcase_11 AC 43 ms
49,244 KB
testcase_12 AC 43 ms
49,488 KB
testcase_13 AC 44 ms
49,304 KB
testcase_14 AC 43 ms
49,172 KB
testcase_15 AC 44 ms
49,184 KB
testcase_16 AC 43 ms
49,056 KB
testcase_17 AC 43 ms
49,172 KB
testcase_18 AC 44 ms
49,176 KB
testcase_19 AC 43 ms
49,240 KB
testcase_20 AC 126 ms
54,296 KB
testcase_21 AC 133 ms
53,880 KB
testcase_22 AC 141 ms
54,272 KB
testcase_23 AC 132 ms
54,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        char[] arr = br.readLine().toCharArray();
        for (int i = 1; i < arr.length; i++) {
            if (arr[i] == arr[i - 1]) {
                System.out.println("YES");
                return;
            }
        }
        if (arr.length >= 4) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}
0