結果

問題 No.290 1010
ユーザー tentententen
提出日時 2020-12-18 15:36:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 269 ms / 5,000 ms
コード長 610 bytes
コンパイル時間 2,383 ms
コンパイル使用メモリ 77,924 KB
実行使用メモリ 64,436 KB
最終ジャッジ日時 2023-10-21 08:09:32
合計ジャッジ時間 6,146 ms
ジャッジサーバーID
(参考情報)
judge10 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
57,044 KB
testcase_01 AC 112 ms
56,980 KB
testcase_02 AC 112 ms
57,240 KB
testcase_03 AC 112 ms
57,088 KB
testcase_04 AC 115 ms
57,452 KB
testcase_05 AC 113 ms
57,256 KB
testcase_06 AC 111 ms
57,264 KB
testcase_07 AC 103 ms
56,080 KB
testcase_08 AC 122 ms
57,224 KB
testcase_09 AC 109 ms
56,996 KB
testcase_10 AC 111 ms
57,028 KB
testcase_11 AC 116 ms
56,972 KB
testcase_12 AC 113 ms
57,252 KB
testcase_13 AC 110 ms
57,200 KB
testcase_14 AC 108 ms
57,232 KB
testcase_15 AC 112 ms
56,972 KB
testcase_16 AC 118 ms
57,460 KB
testcase_17 AC 113 ms
57,264 KB
testcase_18 AC 116 ms
57,268 KB
testcase_19 AC 108 ms
56,064 KB
testcase_20 AC 269 ms
64,316 KB
testcase_21 AC 269 ms
64,436 KB
testcase_22 AC 241 ms
64,288 KB
testcase_23 AC 262 ms
64,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        char[] arr = sc.next().toCharArray();
        boolean can;
        if (n == 1) {
            can = false;
        } else if (n == 2) {
            can = (arr[0] == arr[1]);
        } else if (n == 3) {
            can = (arr[0] == arr[1] || arr[1] == arr[2]);
        } else {
            can = true;
        }
        if (can) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}
0