結果

問題 No.311 z in FizzBuzzString
ユーザー kashiwagi513
提出日時 2019-03-01 00:58:25
言語 OCaml
(5.2.1)
結果
TLE  
実行時間 -
コード長 351 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 19,820 KB
実行使用メモリ 13,760 KB
最終ジャッジ日時 2024-09-24 22:15:27
合計ジャッジ時間 3,227 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 TLE * 1 -- * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

let solve n =
  let rec inner m acc3 acc5 =
    if 3*m > n && 5*m > n then (acc3, acc5)
    else if 3*m > n then inner (m+1) acc3 (acc5 + 2)
    else if 5*m > n then inner (m+1) (acc3 + 2) acc5
    else inner (m+1) (acc3 + 2) (acc5 + 2)
  in
  let x, y = inner 1 0 0 in
  print_int (x + y)

let _ =
  let n = int_of_string @@ read_line() in
  solve n
0