結果
| 問題 | No.939 and or | 
| コンテスト | |
| ユーザー |  bluemegane | 
| 提出日時 | 2021-04-26 15:04:50 | 
| 言語 | C#(csc) (csc 3.9.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 883 bytes | 
| コンパイル時間 | 902 ms | 
| コンパイル使用メモリ | 104,192 KB | 
| 実行使用メモリ | 19,072 KB | 
| 最終ジャッジ日時 | 2024-07-05 00:00:22 | 
| 合計ジャッジ時間 | 2,679 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 12 WA * 18 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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 < 31; 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));
    }
}
            
            
            
        