結果

問題 No.279 木の数え上げ
ユーザー re1ns
提出日時 2015-11-04 16:33:57
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 403 bytes
コンパイル時間 515 ms
コンパイル使用メモリ 57,040 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-14 15:19:20
合計ジャッジ時間 1,292 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;
int main(){
    string s;
    int ans=0,cnt_t=0,cnt_r=0,cnt_e=0;
    cin >> s;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='t')cnt_t++;
        if(s[i]=='r')cnt_r++;
        if(s[i]=='e')cnt_e++;
        if(cnt_t>=1&&cnt_r>=1&&cnt_e>=2)
        {
            ans++;
            cnt_t-=1;cnt_r-=1;cnt_e-=2;
        }
    }

    cout << ans << endl;
}
0