結果

問題 No.2063 ±2^k operations (easy)
ユーザー ks2mks2m
提出日時 2022-09-02 21:57:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 219 ms / 2,000 ms
コード長 621 bytes
コンパイル時間 3,542 ms
コンパイル使用メモリ 71,428 KB
実行使用メモリ 56,792 KB
最終ジャッジ日時 2023-08-10 03:57:34
合計ジャッジ時間 7,823 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,708 KB
testcase_01 AC 122 ms
55,672 KB
testcase_02 AC 121 ms
55,668 KB
testcase_03 AC 121 ms
56,008 KB
testcase_04 AC 123 ms
55,860 KB
testcase_05 AC 123 ms
55,800 KB
testcase_06 AC 123 ms
56,140 KB
testcase_07 AC 120 ms
55,952 KB
testcase_08 AC 120 ms
55,920 KB
testcase_09 AC 120 ms
55,412 KB
testcase_10 AC 121 ms
55,680 KB
testcase_11 AC 123 ms
55,640 KB
testcase_12 AC 125 ms
55,416 KB
testcase_13 AC 125 ms
55,356 KB
testcase_14 AC 123 ms
55,704 KB
testcase_15 AC 125 ms
55,428 KB
testcase_16 AC 126 ms
55,724 KB
testcase_17 AC 219 ms
56,444 KB
testcase_18 AC 217 ms
56,484 KB
testcase_19 AC 218 ms
56,356 KB
testcase_20 AC 213 ms
56,792 KB
testcase_21 AC 217 ms
56,336 KB
testcase_22 AC 219 ms
56,152 KB
testcase_23 AC 215 ms
54,692 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