結果
| 問題 | No.418 ミンミンゼミ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-05-05 19:30:37 |
| 言語 | OCaml (5.5.0) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 1,000 ms |
| + 114µs | |
| コード長 | 469 bytes |
| 記録 | |
| コンパイル時間 | 104 ms |
| コンパイル使用メモリ | 21,248 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-09-12 07:10:00 |
| 合計ジャッジ時間 | 1,736 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 25 |
コンパイルメッセージ
ocamlfind: [WARNING] Cannot read directory ./stublibs which is mentioned in ld.conf
ソースコード
let count_matches str s =
let r = Str.regexp_string s
and len_str = String.length str
and len_s = String.length s
in
let rec count_matches' i result =
if i >= len_str then
result
else
try
let idx = Str.search_forward r str i in
count_matches' (idx + len_s) (result + 1)
with Not_found -> result
in
count_matches' 0 0
let () =
let s = read_line () in
count_matches s "n"
|> string_of_int
|> print_endline