結果
問題 | No.805 UMG |
ユーザー |
|
提出日時 | 2021-06-11 12:33:35 |
言語 | OCaml (5.2.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 454 bytes |
コンパイル時間 | 1,560 ms |
コンパイル使用メモリ | 19,564 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-18 14:10:53 |
合計ジャッジ時間 | 1,732 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 WA * 18 |
ソースコード
let fl_help a hd = let (current, result) = a in match hd with | 'U' -> ('U', result) | 'M' when current = 'U' -> ('M', result) | 'G' when current = 'M' -> ('G', result + 1) | 'G' when current = 'G' -> ('G', result + 1) | _ -> a;; let calc s = let (_, result) = Seq.fold_left fl_help (' ', 0) s in result;; let () = read_line () |> ignore; let seq = read_line () |> String.to_seq in calc seq |> print_int; print_newline ();;