結果
問題 | No.2 素因数ゲーム |
ユーザー |
|
提出日時 | 2024-09-19 09:49:15 |
言語 | F# (F# 4.0) |
結果 |
AC
|
実行時間 | 197 ms / 5,000 ms |
コード長 | 800 bytes |
コンパイル時間 | 14,189 ms |
コンパイル使用メモリ | 185,460 KB |
実行使用メモリ | 31,488 KB |
最終ジャッジ日時 | 2024-09-19 09:49:33 |
合計ジャッジ時間 | 10,945 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (240 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/
ソースコード
open System open System.Collections.Generic let primeFactorization n = let factors = Dictionary<int, int>() let mutable num = n while num % 2 = 0 do factors.[2] <- factors.TryGetValue(2) |> function (true, v) -> v + 1 | _ -> 1 num <- num / 2 let mutable divisor = 3 while num > 1 do while num % divisor = 0 do factors.[divisor] <- factors.TryGetValue(divisor) |> function (true, v) -> v + 1 | _ -> 1 num <- num / divisor divisor <- divisor + 2 factors [<EntryPoint>] let yuki2 args : int = let n = Console.ReadLine() |> int let factorsMap = primeFactorization n let mutable ret = 0 for KeyValue(_, v) in factorsMap do ret <- ret ^^^ v printfn "%s" (if ret = 0 then "Bob" else "Alice") 0