結果

問題 No.939 and or
ユーザー bluemeganebluemegane
提出日時 2021-04-26 15:09:56
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 682 bytes
コンパイル時間 738 ms
コンパイル使用メモリ 63,240 KB
実行使用メモリ 25,132 KB
最終ジャッジ日時 2023-09-18 08:01:28
合計ジャッジ時間 3,756 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
22,988 KB
testcase_01 AC 55 ms
20,700 KB
testcase_02 AC 61 ms
23,132 KB
testcase_03 AC 55 ms
20,684 KB
testcase_04 AC 62 ms
23,260 KB
testcase_05 AC 56 ms
22,672 KB
testcase_06 AC 60 ms
25,108 KB
testcase_07 AC 61 ms
21,164 KB
testcase_08 AC 60 ms
23,232 KB
testcase_09 AC 56 ms
20,636 KB
testcase_10 AC 61 ms
23,184 KB
testcase_11 AC 61 ms
23,228 KB
testcase_12 AC 59 ms
23,036 KB
testcase_13 AC 55 ms
18,816 KB
testcase_14 AC 60 ms
21,140 KB
testcase_15 AC 61 ms
23,228 KB
testcase_16 AC 55 ms
20,680 KB
testcase_17 AC 60 ms
23,096 KB
testcase_18 AC 59 ms
22,980 KB
testcase_19 AC 60 ms
23,176 KB
testcase_20 AC 55 ms
20,688 KB
testcase_21 AC 61 ms
25,132 KB
testcase_22 AC 56 ms
20,664 KB
testcase_23 AC 60 ms
23,164 KB
testcase_24 AC 61 ms
23,128 KB
testcase_25 AC 60 ms
23,124 KB
testcase_26 AC 60 ms
23,036 KB
testcase_27 AC 60 ms
23,112 KB
testcase_28 AC 60 ms
25,124 KB
testcase_29 AC 54 ms
20,732 KB
testcase_30 AC 55 ms
20,708 KB
testcase_31 AC 55 ms
22,752 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 count = 0;
        for (int i = 0; i < 32; 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