結果

問題 No.136 Yet Another GCD Problem
ユーザー tak
提出日時 2018-03-22 23:51:55
言語 F#
(F# 4.0)
結果
AC  
実行時間 364 ms / 5,000 ms
コード長 254 bytes
コンパイル時間 7,304 ms
コンパイル使用メモリ 193,368 KB
実行使用メモリ 41,556 KB
最終ジャッジ日時 2024-06-24 20:33:45
合計ジャッジ時間 23,166 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 39
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (249 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/

ソースコード

diff #

open System

let rec gcd a b =
    match b with 
    | 0 -> a
    | _ -> gcd b (a%b)

let N,K = 
    let t = Console.ReadLine().Split()
            |> Array.map(int)
    t.[0],t.[1]

[1..N-1]
|> List.map (fun x -> gcd x (N-x))
|> List.max
|> printfn "%i"
0