結果

問題 No.939 and or
ユーザー htensaihtensai
提出日時 2020-01-18 19:17:03
言語 Java19
(openjdk 21)
結果
WA  
実行時間 -
コード長 631 bytes
コンパイル時間 1,967 ms
コンパイル使用メモリ 71,444 KB
実行使用メモリ 51,372 KB
最終ジャッジ日時 2023-09-10 09:48:19
合計ジャッジ時間 4,802 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,492 KB
testcase_01 AC 43 ms
49,396 KB
testcase_02 AC 43 ms
49,520 KB
testcase_03 AC 43 ms
49,216 KB
testcase_04 AC 43 ms
49,464 KB
testcase_05 WA -
testcase_06 AC 43 ms
49,380 KB
testcase_07 AC 44 ms
49,516 KB
testcase_08 AC 43 ms
49,232 KB
testcase_09 AC 42 ms
49,312 KB
testcase_10 AC 43 ms
49,436 KB
testcase_11 AC 42 ms
47,464 KB
testcase_12 AC 44 ms
49,228 KB
testcase_13 WA -
testcase_14 AC 43 ms
49,532 KB
testcase_15 AC 43 ms
49,608 KB
testcase_16 AC 43 ms
49,340 KB
testcase_17 AC 43 ms
49,852 KB
testcase_18 AC 43 ms
49,324 KB
testcase_19 AC 43 ms
49,428 KB
testcase_20 WA -
testcase_21 AC 43 ms
49,612 KB
testcase_22 AC 43 ms
49,724 KB
testcase_23 AC 43 ms
49,228 KB
testcase_24 AC 42 ms
49,352 KB
testcase_25 AC 43 ms
49,248 KB
testcase_26 AC 42 ms
49,284 KB
testcase_27 AC 43 ms
49,448 KB
testcase_28 AC 43 ms
49,416 KB
testcase_29 WA -
testcase_30 AC 42 ms
49,372 KB
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] line = br.readLine().split(" ", 2);
        int a = Integer.parseInt(line[0]);
        int b = Integer.parseInt(line[1]);
        if ((a & b) != a) {
            System.out.println(0);
            return;
        }
        int count = 0;
        int c = b - a;
        while (c > 0) {
            count += c % 2;
            c /= 2;
        }
        System.out.println((long)(Math.pow(2, count - 1)));
    }
}
0