結果

問題 No.279 木の数え上げ
ユーザー tanson
提出日時 2025-09-18 01:17:05
言語 Standard ML
(MLton 20210117)
結果
MLE  
実行時間 -
コード長 821 bytes
コンパイル時間 3,488 ms
コンパイル使用メモリ 691,836 KB
実行使用メモリ 75,252 KB
最終ジャッジ日時 2025-09-18 01:17:11
合計ジャッジ時間 4,923 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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))
                (Int.toLarge 0, Int.toLarge 0, Int.toLarge 0)
                (String.explode s)
        val ans = LargeInt.min (numOfT, LargeInt.min (numOfR, numOfE div 2))
    in
        print (LargeInt.toString ans ^ "\n")
    end

0