結果

問題 No.290 1010
ユーザー kou6839
提出日時 2015-10-21 12:48:14
言語 Java
(openjdk 23)
結果
AC  
実行時間 296 ms / 5,000 ms
コード長 456 bytes
コンパイル時間 2,355 ms
コンパイル使用メモリ 74,400 KB
実行使用メモリ 57,300 KB
最終ジャッジ日時 2024-07-22 11:09:18
合計ジャッジ時間 6,594 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

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