結果

問題 No.405 ローマ数字の腕時計
ユーザー maimai8
提出日時 2020-07-26 11:29:27
言語 OCaml
(5.2.1)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 449 bytes
コンパイル時間 968 ms
コンパイル使用メモリ 21,576 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-06 19:29:33
合計ジャッジ時間 1,672 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

let () =
  let time = [(1, "I");(2, "II");(3, "III");(4, "IIII");(5, "V");
              (6, "VI");(7, "VII");(8, "VIII");(9, "IX");(10, "X");(11, "XI");(12, "XII")] in
  Scanf.scanf "%s %d\n" @@ fun s t ->
  let (now, _) = List.find (fun (n, m) -> m = s) time in
  let search = (now + t) mod 12 in
  let s = if search < 0 then 12 + search else if search = 0 then 12 else search in
  Printf.printf "%s\n" (snd (List.find (fun (n, m) -> n = s) time))
0