結果

問題 No.939 and or
ユーザー htensaihtensai
提出日時 2020-01-18 19:09:33
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 713 bytes
コンパイル時間 2,266 ms
コンパイル使用メモリ 71,376 KB
実行使用メモリ 51,344 KB
最終ジャッジ日時 2023-09-10 09:34:57
合計ジャッジ時間 4,982 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,348 KB
testcase_01 AC 43 ms
49,656 KB
testcase_02 WA -
testcase_03 AC 43 ms
49,412 KB
testcase_04 AC 43 ms
49,344 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 42 ms
47,420 KB
testcase_10 AC 42 ms
49,332 KB
testcase_11 WA -
testcase_12 AC 42 ms
49,272 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 42 ms
49,352 KB
testcase_17 WA -
testcase_18 AC 43 ms
47,808 KB
testcase_19 AC 43 ms
49,396 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 43 ms
49,272 KB
testcase_23 AC 44 ms
49,380 KB
testcase_24 WA -
testcase_25 AC 44 ms
49,140 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 43 ms
49,208 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]);
        int count = 0;
        while (a > 0 && b > 0) {
            if (a % 2 == 0 && b % 2 == 1) {
                count++;
            } else if (a % 2 == 1 && b % 2 == 0) {
                System.out.println(0);
                return;
            }
            a /= 2;
            b /= 2;
        }
        System.out.println((long)(Math.pow(2, count - 1)));
    }
}
0