結果
| 問題 |
No.296 n度寝
|
| コンテスト | |
| ユーザー |
piconic_X
|
| 提出日時 | 2015-11-07 01:32:49 |
| 言語 | OCaml (5.2.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 871 bytes |
| コンパイル時間 | 513 ms |
| コンパイル使用メモリ | 20,724 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-08 23:37:18 |
| 合計ジャッジ時間 | 1,094 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 16 |
コンパイルメッセージ
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)
ソースコード
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 ()
piconic_X