結果
問題 | No.495 (^^*) Easy |
ユーザー |
![]() |
提出日時 | 2017-08-15 10:17:17 |
言語 | OCaml (5.2.1) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 534 bytes |
コンパイル時間 | 375 ms |
コンパイル使用メモリ | 22,092 KB |
実行使用メモリ | 5,504 KB |
最終ジャッジ日時 | 2024-10-09 00:16:33 |
合計ジャッジ時間 | 832 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 |
ソースコード
module String = structinclude Stringlet fold_left f init str =let n = String.length str - 1 inlet rec doit i acc =if i > n then accelse doit (i + 1) (f acc str.[i]) indoit 0 initendlet () =let (l, r), _ = read_line () |> String.fold_left (fun ((l, r), p) c ->if c = '*' then (l, r), trueelse if not p then (l, r), falseelse if c = ')' then (l + 1, r), falseelse if c = '^' then (l, r + 1), falseelse assert false)((0, 0), false) inPrintf.printf "%d %d\n" l r