結果

問題 No.939 and or
ユーザー ks2mks2m
提出日時 2019-12-03 00:09:51
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 428 bytes
コンパイル時間 2,148 ms
コンパイル使用メモリ 74,224 KB
実行使用メモリ 54,528 KB
最終ジャッジ日時 2024-05-03 21:32:24
合計ジャッジ時間 7,494 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
39,900 KB
testcase_01 AC 130 ms
41,184 KB
testcase_02 AC 131 ms
41,216 KB
testcase_03 AC 131 ms
41,624 KB
testcase_04 AC 133 ms
41,008 KB
testcase_05 WA -
testcase_06 AC 133 ms
41,452 KB
testcase_07 AC 137 ms
41,120 KB
testcase_08 AC 132 ms
40,868 KB
testcase_09 AC 132 ms
41,340 KB
testcase_10 AC 130 ms
41,352 KB
testcase_11 AC 128 ms
40,904 KB
testcase_12 AC 129 ms
40,956 KB
testcase_13 WA -
testcase_14 AC 121 ms
40,016 KB
testcase_15 AC 132 ms
40,892 KB
testcase_16 AC 131 ms
41,068 KB
testcase_17 AC 133 ms
41,276 KB
testcase_18 AC 138 ms
40,980 KB
testcase_19 AC 130 ms
41,012 KB
testcase_20 WA -
testcase_21 AC 130 ms
40,960 KB
testcase_22 AC 118 ms
39,964 KB
testcase_23 AC 130 ms
41,144 KB
testcase_24 AC 132 ms
41,044 KB
testcase_25 AC 131 ms
41,228 KB
testcase_26 AC 131 ms
41,128 KB
testcase_27 AC 130 ms
41,248 KB
testcase_28 AC 133 ms
41,040 KB
testcase_29 WA -
testcase_30 AC 133 ms
41,288 KB
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();

		if ((a & b) != a) {
			System.out.println(0);
			return;
		}

		int c = b - a;
		int cnt = 0;
		for (int i = 0; i < 32; i++) {
			if ((c >> i & 1) == 1) {
				cnt++;
			}
		}
		System.out.println(1 << (cnt - 1));
	}
}
0