結果

問題 No.296 n度寝
ユーザー piconic_Xpiconic_X
提出日時 2015-11-07 01:32:49
言語 OCaml
(5.1.0)
結果
RE  
実行時間 -
コード長 871 bytes
コンパイル時間 1,481 ms
コンパイル使用メモリ 20,720 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 08:30:20
合計ジャッジ時間 945 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
File "Main.ml", line 27, characters 45-60:
27 | let rec try_exe () = try exe () with Failure "int_of_string" -> print_newline ();
                                                  ^^^^^^^^^^^^^^^
Warning 52 [fragile-literal-pattern]: Code should not depend on the actual values of
this constructor's arguments. They are only for information
and may change in future versions. (see manual section 13.5.3)

ソースコード

diff #

let minute_to_hour m =
  (m / 60) mod 24

let waketime n h m t =
  let rec wakeminutes n' m' =
    if n' = 1 then (* 0ではない *)
      let hour = minute_to_hour m' in
      let minute = m' mod 60 in
      Printf.printf "%d\n%d\n" hour minute
    else
      wakeminutes (n'- 1) (m' + t)
  in
  wakeminutes n (h * 60 + m)

let exe () =
  print_endline "\nInput values.";
  print_endline " nidone times = ?";
  let n = int_of_string (read_line ()) in
  print_endline " alarm rings at (hour) = ?";
  let h = int_of_string (read_line ()) in
  print_endline " alarm rings at (minute) = ?";
  let m = int_of_string (read_line ()) in
  print_endline " alarm ringing interval (minute) = ?";
  let t = int_of_string (read_line ()) in
  waketime n h m t

let rec try_exe () = try exe () with Failure "int_of_string" -> print_newline ();
								try_exe ()

let () = try_exe ()
0