結果

問題 No.736 約比
ユーザー kou_kkk
提出日時 2025-08-09 16:17:13
言語 F#
(F# 4.0)
結果
AC  
実行時間 287 ms / 2,000 ms
コード長 516 bytes
コンパイル時間 14,491 ms
コンパイル使用メモリ 202,148 KB
実行使用メモリ 54,460 KB
最終ジャッジ日時 2025-08-09 16:17:36
合計ジャッジ時間 18,927 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 65
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (349 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

let n = stdin.ReadLine()
let mutable a =
    stdin.ReadLine().Split()
    |> Array.map int64
let factorize n =
    let rec go x i =
        if i * i > x then
            [x]
        elif x % i = 0L then
            i :: go (x / i) i
        else
            i + 1L
            |> go x
    go n 2L
let ps =
    a
    |> Array.min
    |> factorize
 
for p in ps do
    if Array.forall (fun v -> (v % p) = 0L) a then
        a <- Array.map (fun v -> v / p) a
 
a
|> Array.map string
|> String.concat ":"
|> printfn "%s"
0