結果
| 問題 | No.2 素因数ゲーム |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-09-19 09:49:15 |
| 言語 | F# (F# 10.0) |
| 結果 |
AC
|
| 実行時間 | 133 ms / 5,000 ms |
| コード長 | 800 bytes |
| 記録 | |
| コンパイル時間 | 6,836 ms |
| コンパイル使用メモリ | 210,712 KB |
| 実行使用メモリ | 34,176 KB |
| 最終ジャッジ日時 | 2026-04-07 19:46:46 |
| 合計ジャッジ時間 | 11,547 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 31 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (185 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net10.0/main.dll main -> /home/judge/data/code/bin/Release/net10.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