結果

問題 No.290 1010
ユーザー kou6839kou6839
提出日時 2015-10-21 12:48:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 295 ms / 5,000 ms
コード長 456 bytes
コンパイル時間 2,505 ms
コンパイル使用メモリ 71,656 KB
実行使用メモリ 61,212 KB
最終ジャッジ日時 2023-09-29 17:05:06
合計ジャッジ時間 7,441 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,872 KB
testcase_01 AC 118 ms
55,900 KB
testcase_02 AC 119 ms
56,476 KB
testcase_03 AC 119 ms
55,596 KB
testcase_04 AC 120 ms
55,616 KB
testcase_05 AC 119 ms
55,644 KB
testcase_06 AC 121 ms
55,468 KB
testcase_07 AC 119 ms
55,752 KB
testcase_08 AC 117 ms
55,924 KB
testcase_09 AC 117 ms
55,832 KB
testcase_10 AC 118 ms
55,624 KB
testcase_11 AC 117 ms
55,832 KB
testcase_12 AC 123 ms
55,624 KB
testcase_13 AC 121 ms
55,872 KB
testcase_14 AC 122 ms
56,068 KB
testcase_15 AC 122 ms
55,684 KB
testcase_16 AC 119 ms
55,556 KB
testcase_17 AC 120 ms
55,424 KB
testcase_18 AC 119 ms
55,740 KB
testcase_19 AC 119 ms
55,740 KB
testcase_20 AC 285 ms
59,192 KB
testcase_21 AC 295 ms
61,212 KB
testcase_22 AC 275 ms
59,032 KB
testcase_23 AC 272 ms
58,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		String in = sc.next();
		if(in.length()>=4) System.out.println("YES");
		else if(in.length()==1) System.out.println("NO");
		else{
			for(int i=0;i<in.length()-1;i++){
				if(in.charAt(i)==in.charAt(i+1)){
					System.out.println("YES");
					return;
				}
			}
			System.out.println("NO");
		}
		
	}
}
0