結果

問題 No.2619 Sorted Nim
ユーザー heno239
提出日時 2024-02-02 16:43:56
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 778 bytes
コンパイル時間 8,620 ms
コンパイル使用メモリ 166,588 KB
実行使用メモリ 214,540 KB
最終ジャッジ日時 2024-09-28 10:36:33
合計ジャッジ時間 16,220 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 62
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (108 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

// See https://aka.ms/new-console-template for more information
using System.Collections;
using System.Runtime.InteropServices;

internal class Program
{
    public static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        int[] a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        ArrayList ds = new ArrayList();
        ds.Add(a[0]);
        for (int i = 1; i < n; i++)
        {
            ds.Add(a[i] - a[i - 1]);
        }
        ds.Reverse();
        int x = 0;
        for (int i = 0; i < ds.Count; i += 2)
        {
            x ^= (int)ds[i];
        }

        if (x>0)
        {
            Console.WriteLine("First");
        }
        else
        {
            Console.WriteLine("Second");
        }
    }
}
0