結果

問題 No.939 and or
ユーザー htensaihtensai
提出日時 2019-12-09 11:31:57
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 684 bytes
コンパイル時間 3,180 ms
コンパイル使用メモリ 70,760 KB
実行使用メモリ 56,296 KB
最終ジャッジ日時 2023-09-03 17:13:21
合計ジャッジ時間 8,008 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,596 KB
testcase_01 AC 124 ms
55,736 KB
testcase_02 WA -
testcase_03 AC 122 ms
53,856 KB
testcase_04 AC 124 ms
55,752 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 122 ms
55,716 KB
testcase_10 AC 123 ms
56,296 KB
testcase_11 WA -
testcase_12 AC 121 ms
55,888 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 123 ms
55,580 KB
testcase_17 WA -
testcase_18 AC 122 ms
55,640 KB
testcase_19 AC 126 ms
55,760 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 124 ms
56,060 KB
testcase_23 AC 122 ms
55,920 KB
testcase_24 WA -
testcase_25 AC 124 ms
56,096 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 122 ms
55,744 KB
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int count = 0;
        while (a > 0 && b > 0) {
            int aa = a % 2;
            int bb = b % 2;
            if (aa == 0 && bb == 1) {
                count++;
            } else if (aa == 1 && bb == 0) {
                count = 0;
                break;
            }
            a /= 2;
            b /= 2;
        }
        if (count == 0) {
            System.out.println(0);
        } else {
            System.out.println((long)(Math.pow(2, count - 1)));
        }
    }
}
0