結果
| 問題 | No.436 ccw |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-29 10:59:11 |
| 言語 | OCaml (5.5.0) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 2,000 ms |
| + 499µs | |
| コード長 | 472 bytes |
| 記録 | |
| コンパイル時間 | 104 ms |
| コンパイル使用メモリ | 21,248 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-09-12 07:08:12 |
| 合計ジャッジ時間 | 1,755 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 |
コンパイルメッセージ
ocamlfind: [WARNING] Cannot read directory ./stublibs which is mentioned in ld.conf
ソースコード
let solve s =
let rec solve' idx c_num w_num =
if idx >= String.length s then (c_num, w_num)
else
let next_c_num, next_w_num =
match s.[idx] with
| 'c' -> c_num + 1, w_num
| 'w' -> c_num, w_num + 1
| _ -> failwith "hoge"
in
solve' (idx + 1) next_c_num next_w_num
in
let c_num, w_num = solve' 0 0 0 in
min (c_num - 1) w_num
let () =
let s = read_line () in
solve s |> string_of_int |> print_endline