結果

問題 No.939 and or
ユーザー bluemeganebluemegane
提出日時 2021-04-26 15:08:49
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 883 bytes
コンパイル時間 896 ms
コンパイル使用メモリ 65,608 KB
実行使用メモリ 25,204 KB
最終ジャッジ日時 2023-09-18 08:00:30
合計ジャッジ時間 4,231 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
24,940 KB
testcase_01 AC 58 ms
20,664 KB
testcase_02 AC 64 ms
24,996 KB
testcase_03 AC 58 ms
20,588 KB
testcase_04 AC 64 ms
25,096 KB
testcase_05 AC 58 ms
20,752 KB
testcase_06 AC 65 ms
23,080 KB
testcase_07 AC 64 ms
23,068 KB
testcase_08 AC 64 ms
25,088 KB
testcase_09 AC 58 ms
20,636 KB
testcase_10 AC 64 ms
24,956 KB
testcase_11 AC 64 ms
23,112 KB
testcase_12 AC 64 ms
25,064 KB
testcase_13 AC 58 ms
20,648 KB
testcase_14 AC 63 ms
23,128 KB
testcase_15 AC 64 ms
25,096 KB
testcase_16 AC 58 ms
20,480 KB
testcase_17 AC 64 ms
21,180 KB
testcase_18 AC 63 ms
23,152 KB
testcase_19 AC 64 ms
23,164 KB
testcase_20 AC 58 ms
22,652 KB
testcase_21 AC 63 ms
23,028 KB
testcase_22 AC 58 ms
20,588 KB
testcase_23 AC 63 ms
23,184 KB
testcase_24 AC 64 ms
23,284 KB
testcase_25 AC 64 ms
25,204 KB
testcase_26 AC 64 ms
23,148 KB
testcase_27 AC 63 ms
22,960 KB
testcase_28 AC 64 ms
23,080 KB
testcase_29 AC 59 ms
22,592 KB
testcase_30 AC 59 ms
18,672 KB
testcase_31 AC 59 ms
20,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using static System.Math;
using System;

public class Hello
{
    public static long a, b;
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        a = long.Parse(line[0]);
        b = long.Parse(line[1]);
        getAns();
    }
    static bool check(long t, int p) => ((t >> p) & 1) == 1;
    static void getAns()
    {
        var x = 1L;
        var imax = 0;
        var abmax = Max(a, b);
        for (int i = 0; i < 32; i++)
        {
            if (x >= abmax) { imax = i; break; }
            x *= 2;
        }
        var count = 0;
        for (int i = 0; i < imax; i++)
        {
            if (check(a, i) && !check(b, i)) { Console.WriteLine(0); return; }
            if (!check(a, i) && check(b, i)) count++;
        }
        if (count <= 1) Console.WriteLine(1);
        else Console.WriteLine(Pow(2, count - 1));
    }
}
0