結果
問題 |
No.279 木の数え上げ
|
ユーザー |
|
提出日時 | 2025-09-18 01:33:27 |
言語 | Standard ML (MLton 20210117) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 612 bytes |
コンパイル時間 | 3,234 ms |
コンパイル使用メモリ | 689,788 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-09-18 01:33:32 |
合計ジャッジ時間 | 4,159 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
fun tally (nt, nr, ne) = if TextIO.endOfStream TextIO.stdIn then (nt, nr, ne) else case TextIO.input1 TextIO.stdIn of SOME c => if c = #"t" then tally (nt + 1, nr, ne) else if c = #"r" then tally (nt, nr + 1, ne) else if c = #"e" then tally (nt, nr, ne + 1) else tally (nt, nr, ne) | NONE => (nt, nr, ne) val () = let val (numOfT, numOfR, numOfE) = tally (0, 0, 0) val ans = Int.min (numOfT, Int.min (numOfR, numOfE div 2)) in print (Int.toString ans ^ "\n") end