結果

問題 No.939 and or
ユーザー tentententen
提出日時 2023-08-01 13:58:01
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,898 bytes
コンパイル時間 2,196 ms
コンパイル使用メモリ 87,948 KB
実行使用メモリ 50,592 KB
最終ジャッジ日時 2024-04-19 13:17:16
合計ジャッジ時間 4,731 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
50,188 KB
testcase_01 AC 47 ms
50,404 KB
testcase_02 AC 48 ms
50,384 KB
testcase_03 AC 49 ms
50,592 KB
testcase_04 AC 49 ms
50,168 KB
testcase_05 WA -
testcase_06 AC 48 ms
50,360 KB
testcase_07 AC 48 ms
50,380 KB
testcase_08 AC 46 ms
50,404 KB
testcase_09 AC 47 ms
50,524 KB
testcase_10 AC 46 ms
50,060 KB
testcase_11 AC 47 ms
50,184 KB
testcase_12 AC 48 ms
50,512 KB
testcase_13 WA -
testcase_14 AC 47 ms
50,252 KB
testcase_15 AC 47 ms
50,480 KB
testcase_16 AC 47 ms
50,508 KB
testcase_17 AC 47 ms
50,324 KB
testcase_18 AC 46 ms
50,160 KB
testcase_19 AC 47 ms
50,516 KB
testcase_20 WA -
testcase_21 AC 48 ms
50,524 KB
testcase_22 AC 49 ms
50,436 KB
testcase_23 AC 47 ms
50,268 KB
testcase_24 AC 48 ms
50,468 KB
testcase_25 AC 47 ms
50,056 KB
testcase_26 AC 47 ms
50,544 KB
testcase_27 AC 45 ms
50,064 KB
testcase_28 AC 48 ms
50,468 KB
testcase_29 WA -
testcase_30 AC 48 ms
50,548 KB
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int count = 0;
        while (a > 0 || b > 0) {
            if (a % 2 == 0) {
                if (b % 2 == 1) {
                    count++;
                }
            } else {
                if (b % 2 == 0) {
                    System.out.println(0);
                    return;
                }
            }
            a >>= 1;
            b >>= 1;
        }
        System.out.println(1 << (count - 1));
    }
} 
class Utilities {
    static String arrayToLineString(Object[] arr) {
        return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n"));
    }
    
    static String arrayToLineString(int[] arr) {
        return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new));
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public int[] nextIntArray() throws Exception {
        return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0