結果

問題 No.290 1010
ユーザー uafr_cs
提出日時 2015-10-16 23:40:35
言語 Java
(openjdk 23)
結果
AC  
実行時間 330 ms / 5,000 ms
コード長 617 bytes
コンパイル時間 2,432 ms
コンパイル使用メモリ 75,396 KB
実行使用メモリ 45,908 KB
最終ジャッジ日時 2024-07-21 20:45:13
合計ジャッジ時間 7,579 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final int n = sc.nextInt();
		
		final String input = sc.next();
		
		if(n >= 4){
			System.out.println("YES");
		}else if(n == 1){
			System.out.println("NO");
		}else{
			final int num = Integer.parseInt(input, 2);
			if(n == 3){
				System.out.println(num == 2 || num == 5 ? "NO" : "YES");
			}else{
				System.out.println(num == 1 || num == 2 ? "NO" : "YES");
			}
		}
		
	}

}
0