結果
問題 | No.279 木の数え上げ |
ユーザー |
|
提出日時 | 2020-08-02 17:08:36 |
言語 | OCaml (5.2.1) |
結果 |
MLE
|
実行時間 | - |
コード長 | 655 bytes |
コンパイル時間 | 374 ms |
コンパイル使用メモリ | 21,444 KB |
実行使用メモリ | 112,304 KB |
最終ジャッジ日時 | 2024-10-09 01:53:24 |
合計ジャッジ時間 | 4,167 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 MLE * 1 -- * 10 |
ソースコード
let () =let rec charlist_of_string str n i =if i = n then []else str.[i] :: charlist_of_string str n (i+1) inlet rec search lst target = match lst with| [] -> raise Not_found| h :: t -> if h = target then t else h :: search t target inScanf.scanf "%s\n" @@ fun s ->let lst = ref (charlist_of_string s (String.length s) 0) inlet flag = ref true inlet ans = ref 0 inwhile !flag dotrylet l = search !lst 't' inlet l = search l 'r' inlet l = search l 'e' inlet l = search l 'e' inlst := l; ans := !ans + 1with Not_found -> flag := falsedone;Printf.printf "%d\n" !ans