結果

問題 No.405 ローマ数字の腕時計
ユーザー ichibanshibori
提出日時 2016-08-06 14:09:40
言語 F#
(F# 4.0)
結果
AC  
実行時間 71 ms / 2,000 ms
コード長 572 bytes
コンパイル時間 6,266 ms
コンパイル使用メモリ 187,612 KB
実行使用メモリ 31,104 KB
最終ジャッジ日時 2024-07-06 19:01:32
合計ジャッジ時間 9,052 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (210 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

let doIt () =
    let shour, dh = stdin.ReadLine () |> fun str -> str.Split () |> fun arr -> (arr.[0], int arr.[1])

    let hour = match shour with
               | "IX" -> 9
               | s -> seq s |> Seq.map (function | 'I' -> 1 | 'V' -> 5 | _ -> 10) |> Seq.sum

    (hour + (dh % 12) + 12) % 12 |>
    (function | 0 -> 12 | n -> n) |>
    (function | n when n <= 4 -> System.String('I', n)
              | n when n <= 8 -> "V" + System.String('I', n - 5)
              | 9 -> "IX"
              | n -> "X" + System.String('I', n - 10)) |>
    printfn "%s"

doIt ()
0