結果
問題 | No.1446 ハンバーグと納豆ごはん |
ユーザー | esehara |
提出日時 | 2021-06-02 04:33:21 |
言語 | OCaml (5.1.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 922 bytes |
コンパイル時間 | 1,051 ms |
コンパイル使用メモリ | 19,820 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-04-26 13:19:52 |
合計ジャッジ時間 | 5,185 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
10,752 KB |
testcase_01 | AC | 1 ms
5,248 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | TLE | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
ソースコード
let split_on_char sep s = let r = ref [] in let j = ref (String.length s) in for i = String.length s - 1 downto 0 do if String.unsafe_get s i = sep then begin r := String.sub s (i + 1) (!j - i - 1) :: !r; j := i end done; String.sub s 0 !j :: !r;; let rec saiteki_henkan max_henkan gohan modosu = if (max_henkan > gohan) then saiteki_henkan (max_henkan - 1) (gohan + modosu) modosu else min max_henkan gohan;; let cooking a b n m = (min a b) + (if (a > b) then saiteki_henkan ((a - b) / n) ((a - b) mod n) n else saiteki_henkan ((b - a) / m) ((b - a) mod m) m);; let () = let raw = read_line () |> split_on_char ' ' |> List.map int_of_string in let a = List.nth raw 0 in let b = List.nth raw 1 in let n = List.nth raw 2 in let m = List.nth raw 3 in cooking a b n m |> print_int; print_newline ();;