結果

問題 No.279 木の数え上げ
ユーザー tanson
提出日時 2025-09-18 01:14:52
言語 Standard ML
(MLton 20210117)
結果
MLE  
実行時間 -
コード長 770 bytes
コンパイル時間 2,979 ms
コンパイル使用メモリ 689,532 KB
実行使用メモリ 75,108 KB
最終ジャッジ日時 2025-09-18 01:14:58
合計ジャッジ時間 4,804 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 MLE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

fun readStr () =
    let
        fun scan reader stream = SOME (StringCvt.splitl (not o Char.isSpace) reader (StringCvt.skipWS reader stream))
    in
        valOf (TextIO.scanStream scan TextIO.stdIn)
    end


val () =
    let
        val s = readStr ()
        val (numOfT, numOfR, numOfE) =
            List.foldl
                (fn (c, (nt, nr, ne)) =>
                        if c = #"t" then (nt + 1, nr, ne)
                        else if c = #"r" then (nt, nr + 1, ne)
                        else if c = #"e" then (nt, nr, ne + 1)
                        else (nt, nr, ne))
                (0, 0, 0)
                (String.explode s)
        val ans = Int.min (numOfT, Int.min (numOfR, numOfE div 2))
    in
        print (Int.toString ans ^ "\n")
    end

0