結果

問題 No.939 and or
ユーザー 37zigen37zigen
提出日時 2019-12-02 18:55:51
言語 Java21
(openjdk 21)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 785 bytes
コンパイル時間 2,592 ms
コンパイル使用メモリ 74,712 KB
実行使用メモリ 54,220 KB
最終ジャッジ日時 2024-05-03 14:37:51
合計ジャッジ時間 7,238 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
54,132 KB
testcase_01 AC 113 ms
54,084 KB
testcase_02 AC 112 ms
53,828 KB
testcase_03 AC 106 ms
53,220 KB
testcase_04 AC 106 ms
53,036 KB
testcase_05 AC 121 ms
54,020 KB
testcase_06 AC 113 ms
54,032 KB
testcase_07 AC 129 ms
54,064 KB
testcase_08 AC 127 ms
53,880 KB
testcase_09 AC 128 ms
54,100 KB
testcase_10 AC 124 ms
54,096 KB
testcase_11 AC 119 ms
54,012 KB
testcase_12 AC 107 ms
52,520 KB
testcase_13 AC 107 ms
52,916 KB
testcase_14 AC 113 ms
54,104 KB
testcase_15 AC 115 ms
54,012 KB
testcase_16 AC 114 ms
53,884 KB
testcase_17 AC 109 ms
52,600 KB
testcase_18 AC 105 ms
52,868 KB
testcase_19 AC 117 ms
54,192 KB
testcase_20 AC 115 ms
52,996 KB
testcase_21 AC 123 ms
54,132 KB
testcase_22 AC 122 ms
54,168 KB
testcase_23 AC 116 ms
53,836 KB
testcase_24 AC 112 ms
53,928 KB
testcase_25 AC 112 ms
53,864 KB
testcase_26 AC 123 ms
54,212 KB
testcase_27 AC 116 ms
54,220 KB
testcase_28 AC 119 ms
54,128 KB
testcase_29 AC 114 ms
54,032 KB
testcase_30 AC 118 ms
53,868 KB
testcase_31 AC 105 ms
52,648 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;
        //and,or
        //10 x
        //01 10,01
        //11 11
        //00 00
        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);
    }

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}
0