結果
問題 |
No.296 n度寝
|
ユーザー |
![]() |
提出日時 | 2015-11-07 18:03:43 |
言語 | OCaml (5.2.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 802 bytes |
コンパイル時間 | 489 ms |
コンパイル使用メモリ | 20,864 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-08 23:37:24 |
合計ジャッジ時間 | 834 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 16 |
コンパイルメッセージ
File "Main.ml", lines 27-28, characters 2-97: 27 | ..match str_to_list stdin 0 ' ' [] with 28 | [t;m;h;n] -> waketime (int_of_string n) (int_of_string h) (int_of_string m) (int_of_string t) Warning 8 [partial-match]: this pattern-matching is not exhaustive. Here is an example of a case that is not matched: t::m::h::n::_::_
ソースコード
let main stdin = let rec str_to_list str i split list = if i > String.length str then list else let p = (try String.index_from str i split with Not_found -> String.length str) in let word = String.sub str i (p-i) in str_to_list str (p+1) split (word :: list) in let waketime n h m t = let minute_to_hour m = (m / 60) mod 24 in let rec wakeminutes n' m' = if n' = 1 then (* h hour m minute で一回めざまし止める *) 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) in match str_to_list stdin 0 ' ' [] with [t;m;h;n] -> waketime (int_of_string n) (int_of_string h) (int_of_string m) (int_of_string t)