結果
問題 | No.524 コインゲーム |
ユーザー |
![]() |
提出日時 | 2017-06-03 15:29:53 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 26 ms / 1,000 ms |
コード長 | 2,091 bytes |
コンパイル時間 | 881 ms |
コンパイル使用メモリ | 111,308 KB |
実行使用メモリ | 18,048 KB |
最終ジャッジ日時 | 2024-10-02 10:28:43 |
合計ジャッジ時間 | 2,703 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Competitive_Programming { class MainClass { Scanner sc; StringBuilder res; const long MOD = (long)1e9 + 7; static void Main(string[] args) { new MainClass().solve(); } void solve() { sc = new Scanner(); res = new StringBuilder(); long N = sc.NextLong(); res.Append((N % 4 == 3 ? "X" : "O")); Console.WriteLine(res); res.Clear(); } int[] grundy; int dfs(int now) { if (grundy[now] != -1) { return grundy[now]; } HashSet<int> se = new HashSet<int>(); for (int i = now - 1; i >= 0; i--) { se.Add(dfs(i)); } int n = 0; while (se.Contains(n)) { n++; } return grundy[now] = n; } } class Scanner { Queue<string> buf; public Scanner() { buf = new Queue<string>(); } private void GetBuf() { while (buf.Count == 0) { string[] stringArray = Console.ReadLine().Split(' '); if (stringArray.Length == 0 || stringArray[0] == "") { continue; } foreach (string e in stringArray) { buf.Enqueue(e); } } } public int NextInt() { return int.Parse(this.Next()); } public long NextLong() { return long.Parse(this.Next()); } public double NextDouble() { return double.Parse(this.Next()); } public string Next() { this.GetBuf(); return buf.Dequeue(); } } }