結果

問題 No.939 and or
ユーザー neko_the_shadowneko_the_shadow
提出日時 2019-12-04 11:45:05
言語 Java19
(openjdk 21)
結果
AC  
実行時間 50 ms / 2,000 ms
コード長 1,264 bytes
コンパイル時間 2,799 ms
コンパイル使用メモリ 74,548 KB
実行使用メモリ 50,492 KB
最終ジャッジ日時 2023-08-20 03:21:45
合計ジャッジ時間 5,086 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
49,948 KB
testcase_01 AC 48 ms
50,148 KB
testcase_02 AC 48 ms
49,860 KB
testcase_03 AC 49 ms
49,968 KB
testcase_04 AC 49 ms
49,976 KB
testcase_05 AC 48 ms
50,148 KB
testcase_06 AC 49 ms
50,148 KB
testcase_07 AC 50 ms
50,036 KB
testcase_08 AC 49 ms
49,960 KB
testcase_09 AC 49 ms
50,140 KB
testcase_10 AC 49 ms
50,044 KB
testcase_11 AC 48 ms
48,072 KB
testcase_12 AC 48 ms
47,856 KB
testcase_13 AC 49 ms
50,180 KB
testcase_14 AC 48 ms
49,888 KB
testcase_15 AC 49 ms
50,184 KB
testcase_16 AC 49 ms
49,884 KB
testcase_17 AC 49 ms
50,296 KB
testcase_18 AC 49 ms
49,832 KB
testcase_19 AC 49 ms
50,028 KB
testcase_20 AC 50 ms
50,088 KB
testcase_21 AC 49 ms
50,152 KB
testcase_22 AC 49 ms
50,052 KB
testcase_23 AC 49 ms
50,088 KB
testcase_24 AC 48 ms
50,052 KB
testcase_25 AC 49 ms
50,492 KB
testcase_26 AC 48 ms
49,960 KB
testcase_27 AC 48 ms
49,772 KB
testcase_28 AC 49 ms
50,000 KB
testcase_29 AC 48 ms
50,152 KB
testcase_30 AC 48 ms
49,976 KB
testcase_31 AC 49 ms
50,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package _939;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.regex.Pattern;

public class Main {
    public void solve(BufferedReader stdin, PrintWriter stdout) throws NumberFormatException, IOException {
        Pattern space = Pattern.compile(" ");
        String[] line = space.split(stdin.readLine());

        long a = Long.parseLong(line[0]);
        long b = Long.parseLong(line[1]);

        long n = 0;
        for (long i = 31; i >= 0; i--) {
            if ((a & (1 << i)) == 0) {
                if ((b & (1 << i)) != 0) {
                    n++;
                }
            } else {
                if ((b & (1 << i)) == 0) {
                    stdout.println(0);
                    return ;
                }
            }
        }

        long ans = 1;
        for (long i = 0; i < n - 1; i++) ans *= 2;
        stdout.println(ans);
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter stdout = new PrintWriter(System.out, false);
        new Main().solve(stdin, stdout);
        stdout.flush();
    }
}
0