結果

問題 No.316 もっと刺激的なFizzBuzzをください
ユーザー 826814741_6826814741_6
提出日時 2019-01-10 18:54:03
言語 F#
(F# 4.0)
結果
AC  
実行時間 317 ms / 1,000 ms
コード長 349 bytes
コンパイル時間 7,844 ms
コンパイル使用メモリ 185,232 KB
実行使用メモリ 34,756 KB
最終ジャッジ日時 2024-11-24 06:45:49
合計ジャッジ時間 20,565 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (203 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 #

let inline isZero n = n=LanguagePrimitives.GenericZero
let rec gcd a b = if isZero b then a else gcd b (a%b)
let lcm a b = a/(gcd a b)*b
let f n a b c = n/a+n/b+n/c-n/(lcm a b)-n/(lcm b c)-n/(lcm c a)+n/(lcm (lcm a b) c)

let n = stdin.ReadLine() |> int64
let a = stdin.ReadLine().Split(' ') |> Array.map int64

f n a.[0] a.[1] a.[2] |> printfn "%d"
0