結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー piconic_X
提出日時 2015-11-14 23:16:19
言語 OCaml
(5.2.1)
結果
AC  
実行時間 37 ms / 5,000 ms
コード長 249 bytes
コンパイル時間 420 ms
コンパイル使用メモリ 21,448 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-08 23:43:06
合計ジャッジ時間 1,399 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

let rec cookie n cok keep i =
  if cok >= n then i
  else
    let cok2 = cok * 2 in
    if cok2 > n then cookie n (cok - 1) (keep + 1) i
    else cookie n (keep + cok2) 0 (i+1)

let () =
  print_int @@ (Scanf.sscanf (read_line ()) "%d" cookie) 1 0 0
0