結果

問題 No.290 1010
ユーザー spaciaspacia
提出日時 2016-01-18 23:24:31
言語 Java21
(openjdk 21)
結果
AC  
実行時間 150 ms / 5,000 ms
コード長 616 bytes
コンパイル時間 2,289 ms
コンパイル使用メモリ 74,768 KB
実行使用メモリ 57,324 KB
最終ジャッジ日時 2023-10-21 06:49:47
合計ジャッジ時間 5,425 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
53,528 KB
testcase_01 AC 56 ms
52,372 KB
testcase_02 AC 56 ms
52,396 KB
testcase_03 AC 57 ms
53,476 KB
testcase_04 AC 57 ms
52,376 KB
testcase_05 AC 56 ms
53,468 KB
testcase_06 AC 56 ms
53,472 KB
testcase_07 AC 57 ms
53,468 KB
testcase_08 AC 57 ms
53,468 KB
testcase_09 AC 56 ms
53,472 KB
testcase_10 AC 55 ms
53,468 KB
testcase_11 AC 56 ms
52,420 KB
testcase_12 AC 55 ms
51,424 KB
testcase_13 AC 57 ms
53,472 KB
testcase_14 AC 57 ms
53,464 KB
testcase_15 AC 56 ms
53,464 KB
testcase_16 AC 57 ms
53,460 KB
testcase_17 AC 56 ms
53,456 KB
testcase_18 AC 57 ms
52,372 KB
testcase_19 AC 57 ms
53,476 KB
testcase_20 AC 142 ms
57,148 KB
testcase_21 AC 136 ms
57,324 KB
testcase_22 AC 150 ms
57,120 KB
testcase_23 AC 145 ms
55,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.math.*;

class Main {
	
	public static void out (Object o) {
		System.out.println(o);
	}
	
	public static boolean solve (String s , int n) {
		if (n == 1) return false;
		if (n == 2) return !s.equals("01") && !s.equals("10");
		if (n == 3) return !s.equals("010") && !s.equals("101");
		return true;
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		String s = br.readLine();
		
		out(solve(s , n) ? "YES" : "NO");
	}
	
}
0