結果

問題 No.311 z in FizzBuzzString
ユーザー kashiwagi513kashiwagi513
提出日時 2019-03-01 00:58:25
言語 OCaml
(5.1.0)
結果
TLE  
実行時間 -
コード長 351 bytes
コンパイル時間 1,115 ms
コンパイル使用メモリ 22,304 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-25 02:57:08
合計ジャッジ時間 3,907 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,372 KB
testcase_02 AC 2 ms
4,372 KB
testcase_03 AC 1 ms
4,372 KB
testcase_04 AC 2 ms
4,372 KB
testcase_05 AC 2 ms
4,372 KB
testcase_06 AC 1 ms
4,372 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
権限があれば一括ダウンロードができます

ソースコード

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