結果
| 問題 | No.296 n度寝 |
| コンテスト | |
| ユーザー |
piconic_X
|
| 提出日時 | 2015-11-07 01:32:49 |
| 言語 | OCaml (5.4.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 871 bytes |
| 記録 | |
| コンパイル時間 | 377 ms |
| コンパイル使用メモリ | 22,028 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2026-04-25 04:08:48 |
| 合計ジャッジ時間 | 1,098 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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