結果

問題 No.2063 ±2^k operations (easy)
ユーザー ks2mks2m
提出日時 2022-09-02 21:57:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 183 ms / 2,000 ms
コード長 621 bytes
コンパイル時間 2,128 ms
コンパイル使用メモリ 74,316 KB
実行使用メモリ 54,568 KB
最終ジャッジ日時 2024-04-27 21:29:35
合計ジャッジ時間 6,608 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
54,276 KB
testcase_01 AC 92 ms
52,612 KB
testcase_02 AC 104 ms
53,904 KB
testcase_03 AC 106 ms
53,916 KB
testcase_04 AC 94 ms
52,644 KB
testcase_05 AC 100 ms
54,188 KB
testcase_06 AC 104 ms
54,064 KB
testcase_07 AC 94 ms
52,672 KB
testcase_08 AC 103 ms
53,640 KB
testcase_09 AC 107 ms
53,744 KB
testcase_10 AC 100 ms
53,900 KB
testcase_11 AC 102 ms
53,768 KB
testcase_12 AC 93 ms
52,864 KB
testcase_13 AC 111 ms
52,868 KB
testcase_14 AC 102 ms
54,016 KB
testcase_15 AC 91 ms
52,896 KB
testcase_16 AC 105 ms
54,160 KB
testcase_17 AC 170 ms
54,568 KB
testcase_18 AC 163 ms
54,312 KB
testcase_19 AC 172 ms
54,100 KB
testcase_20 AC 183 ms
54,376 KB
testcase_21 AC 160 ms
54,272 KB
testcase_22 AC 164 ms
54,432 KB
testcase_23 AC 172 ms
53,988 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		char[] n = sc.next().toCharArray();
		sc.close();

		int[] c = new int[2];
		for (int i = 0; i < n.length; i++) {
			c[n[i] - '0']++;
		}

		if (c[1] == 2) {
			System.out.println("Yes");
		} else if (c[1] > 2) {
			boolean flg = true;
			for (int i = 0; i < n.length; i++) {
				if (n[i] == '0') {
					flg = false;
				} else if (!flg) {
					System.out.println("No");
					return;
				}
			}
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}
0