結果

問題 No.1674 Introduction to XOR
ユーザー bluemeganebluemegane
提出日時 2021-09-11 07:13:36
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 63 ms / 1,000 ms
コード長 686 bytes
コンパイル時間 1,570 ms
コンパイル使用メモリ 65,104 KB
実行使用メモリ 22,884 KB
最終ジャッジ日時 2023-09-04 09:42:14
合計ジャッジ時間 5,112 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
20,756 KB
testcase_01 AC 59 ms
20,828 KB
testcase_02 AC 60 ms
18,760 KB
testcase_03 AC 60 ms
20,728 KB
testcase_04 AC 60 ms
22,884 KB
testcase_05 AC 59 ms
20,620 KB
testcase_06 AC 60 ms
20,824 KB
testcase_07 AC 60 ms
20,668 KB
testcase_08 AC 61 ms
20,696 KB
testcase_09 AC 60 ms
22,836 KB
testcase_10 AC 60 ms
20,748 KB
testcase_11 AC 60 ms
20,864 KB
testcase_12 AC 60 ms
20,860 KB
testcase_13 AC 60 ms
22,692 KB
testcase_14 AC 60 ms
22,868 KB
testcase_15 AC 60 ms
20,816 KB
testcase_16 AC 60 ms
20,856 KB
testcase_17 AC 61 ms
22,688 KB
testcase_18 AC 61 ms
20,700 KB
testcase_19 AC 59 ms
22,672 KB
testcase_20 AC 61 ms
18,752 KB
testcase_21 AC 60 ms
22,804 KB
testcase_22 AC 62 ms
20,728 KB
testcase_23 AC 63 ms
18,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;

public class Hello
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, long.Parse);
        getAns(n, a);
    }
    static void getAns(int n, long[] a)
    {
        var x = 0L;
        for (int i = 0; i < n; i++) x |= a[i];
        var onf = new bool[61];
        for (int i = 0; i < 60; i++)
        {
            if (((x >> i) & 1) == 1) onf[i] = true;
        }
        var ans = -1L;
        for (int i = 0; i < 61; i++)
        {
            if (!onf[i]) { ans = 1L << i; break; }
        }
        Console.WriteLine(ans);
    }
}
0