結果

問題 No.736 約比
ユーザー kou_kkk
提出日時 2025-08-09 15:53:56
言語 F#
(F# 4.0)
結果
RE  
実行時間 -
コード長 497 bytes
コンパイル時間 9,840 ms
コンパイル使用メモリ 201,072 KB
実行使用メモリ 37,888 KB
最終ジャッジ日時 2025-08-09 15:54:28
合計ジャッジ時間 31,045 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 RE * 58
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (371 ミリ秒)。
  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 int
let factorize n =
    let rec go x i =
        if i * i > x then
            [x]
        elif x % i = 0 then
            i :: go (x / i) i
        else
            i + 1
            |> go x
    go n 2
let ps =
    a.[0]
    |> factorize
 
for p in ps do
    if Array.forall (fun v -> (v % p) = 0) a then
        a <- Array.map (fun v -> v / p) a
 
a
|> Array.map string
|> String.concat ":"
|> printfn "%s"
0