結果
| 問題 |
No.279 木の数え上げ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-02 17:19:40 |
| 言語 | OCaml (5.2.1) |
| 結果 |
MLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 486 bytes |
| コンパイル時間 | 299 ms |
| コンパイル使用メモリ | 21,448 KB |
| 実行使用メモリ | 64,220 KB |
| 最終ジャッジ日時 | 2024-10-09 01:53:41 |
| 合計ジャッジ時間 | 3,215 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 MLE * 1 |
ソースコード
let () =
let rec charlist_of_string str n i =
if i = n then []
else str.[i] :: charlist_of_string str n (i+1) in
let rec count lst target =
List.length (List.filter (fun x -> x = target) lst) in
Scanf.scanf "%s\n" @@ fun s ->
let lst = charlist_of_string s (String.length s) 0 in
let t = count lst 't' in
let r = count lst 'r' in
let e = count lst 'e' in
Printf.printf "%d\n"
(if t < r && t * 2 <= e then t else if r <= t && r * 2 <= e then r else e / 2)