結果

問題 No.9002 FizzBuzz(テスト用)
ユーザー Amsterdam D
提出日時 2022-04-15 09:56:59
言語 OCaml
(5.2.1)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 411 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 21,452 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 17:24:09
合計ジャッジ時間 802 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

let fb = fun c -> match c with
  | c when c mod 15 = 0 -> "FizzBuzz"
  | c when c mod 5  = 0 -> "Buzz"
  | c when c mod 3  = 0 -> "Fizz"
  | _ -> string_of_int c;;

let rec afb = fun l c -> match l <= c with
  | true  -> Printf.printf "%s" (fb c)
  | false ->
      Printf.printf "%s" (fb c) ;
      Printf.printf "%s" "\n" ;
      afb l (1 + c);;
      
let () = Scanf.scanf "%d" (fun x ->
    afb x 1
    
  )
0