結果

問題 No.939 and or
ユーザー 37zigen37zigen
提出日時 2019-12-02 18:57:16
言語 Java21
(openjdk 21)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 615 bytes
コンパイル時間 2,170 ms
コンパイル使用メモリ 71,624 KB
実行使用メモリ 55,988 KB
最終ジャッジ日時 2023-08-16 05:27:35
合計ジャッジ時間 7,729 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,972 KB
testcase_01 AC 126 ms
55,988 KB
testcase_02 AC 130 ms
55,804 KB
testcase_03 AC 128 ms
55,676 KB
testcase_04 AC 127 ms
55,844 KB
testcase_05 AC 127 ms
55,736 KB
testcase_06 AC 127 ms
54,040 KB
testcase_07 AC 126 ms
55,736 KB
testcase_08 AC 128 ms
55,792 KB
testcase_09 AC 127 ms
55,896 KB
testcase_10 AC 127 ms
55,444 KB
testcase_11 AC 128 ms
55,728 KB
testcase_12 AC 129 ms
55,736 KB
testcase_13 AC 130 ms
55,808 KB
testcase_14 AC 129 ms
55,772 KB
testcase_15 AC 130 ms
55,592 KB
testcase_16 AC 129 ms
55,668 KB
testcase_17 AC 130 ms
55,972 KB
testcase_18 AC 130 ms
55,964 KB
testcase_19 AC 134 ms
55,716 KB
testcase_20 AC 130 ms
55,848 KB
testcase_21 AC 130 ms
55,948 KB
testcase_22 AC 130 ms
55,956 KB
testcase_23 AC 130 ms
55,668 KB
testcase_24 AC 128 ms
55,844 KB
testcase_25 AC 128 ms
55,980 KB
testcase_26 AC 128 ms
55,656 KB
testcase_27 AC 128 ms
55,840 KB
testcase_28 AC 129 ms
55,668 KB
testcase_29 AC 124 ms
55,624 KB
testcase_30 AC 128 ms
55,632 KB
testcase_31 AC 128 ms
55,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class Main {
	public static void main(String[] args) {
		new Main().run();
	}
    
    void run() {
        Scanner sc = new Scanner(System.in);
        long A = sc.nextLong();
        long B = sc.nextLong();
        long ans=1;
        for (long i=0;i<31;++i){
            long u=(A>>i)%2;
            long v=(B>>i)%2;
            if(u==1&&v==0)ans=0;
            else if(u==0&&v==1)ans=ans*2;
            else if(u==1&&v==1)ans=ans;
            else if(u==0&&v==0)ans=ans;
        }
        if(ans==1)System.out.println(ans);
        else System.out.println(ans/2);
    }
}
0