結果

問題 No.939 and or
ユーザー htensaihtensai
提出日時 2020-01-18 19:09:33
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 713 bytes
コンパイル時間 1,914 ms
コンパイル使用メモリ 74,496 KB
実行使用メモリ 52,332 KB
最終ジャッジ日時 2024-06-28 01:02:30
合計ジャッジ時間 4,794 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
49,860 KB
testcase_01 AC 52 ms
50,300 KB
testcase_02 WA -
testcase_03 AC 52 ms
49,872 KB
testcase_04 AC 51 ms
49,792 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 51 ms
50,188 KB
testcase_10 AC 52 ms
49,904 KB
testcase_11 WA -
testcase_12 AC 52 ms
50,008 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 52 ms
50,424 KB
testcase_17 WA -
testcase_18 AC 51 ms
50,236 KB
testcase_19 AC 53 ms
49,944 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 53 ms
50,024 KB
testcase_23 AC 51 ms
50,008 KB
testcase_24 WA -
testcase_25 AC 52 ms
50,160 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 52 ms
49,928 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