結果
問題 | No.153 石の山 |
ユーザー |
|
提出日時 | 2024-07-02 16:56:02 |
言語 | C# (.NET 8.0.404) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,302 bytes |
コンパイル時間 | 10,326 ms |
コンパイル使用メモリ | 166,496 KB |
実行使用メモリ | 184,676 KB |
最終ジャッジ日時 | 2024-07-02 16:56:19 |
合計ジャッジ時間 | 15,386 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 15 RE * 12 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (96 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/
ソースコード
using System;using System.Collections.Generic;using System.Linq;public class Program{static int[] memo = { };static int g(int count){if(memo[count] != -1)return memo[count];Dictionary<int, int> dic = new Dictionary<int, int>();if (count >= 2 && count % 2 == 0)dic.Add(g(count / 2) ^ g(count / 2), 1);if (count >= 2 && count % 2 == 1)dic.Add(g(count / 2) ^ g(count / 2 + 1), 1);if (count >= 3 && count % 3 == 0)dic.Add(g(count / 3) ^ g(count / 3) ^ g(count / 3), 1);if (count >= 3 && count % 3 == 1)dic.Add(g(count / 3) ^ g(count / 3) ^ g(count / 3 + 1), 1);if (count >= 3 && count % 3 == 2)dic.Add(g(count / 3) ^ g(count / 3 + 1) ^ g(count / 3 + 1), 1);int ret = 0;while (true){if(!dic.ContainsKey(ret))break;ret++;}memo[count] = ret;return ret;}static void Main(){int N = int.Parse(Console.ReadLine());memo = new int[N + 1];for (int i = 0; i <= N; i++)memo[i] = -1;if (g(N) != 0)Console.WriteLine("A");elseConsole.WriteLine("B");}}