結果

問題 No.290 1010
ユーザー YamaKasa
提出日時 2018-09-09 20:45:52
言語 Java
(openjdk 23)
結果
AC  
実行時間 333 ms / 5,000 ms
コード長 572 bytes
コンパイル時間 2,376 ms
コンパイル使用メモリ 73,952 KB
実行使用メモリ 45,772 KB
最終ジャッジ日時 2024-12-24 04:09:30
合計ジャッジ時間 7,547 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		String S = scan.next();
		scan.close();
		if(N == 1) {
			System.out.println("NO");
		}else if(N == 2) {
			if(S.equals("01") || S.equals("10")) {
				System.out.println("NO");
			}else {
				System.out.println("YES");
			}
		}else if(N == 3) {
			if(S.equals("010") || S.equals("101")) {
				System.out.println("NO");
			}else {
				System.out.println("YES");
			}
		}else {
			System.out.println("YES");
		}
	}
}
0