結果

問題 No.279 木の数え上げ
ユーザー 29da164
提出日時 2020-07-24 17:10:01
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 422 bytes
コンパイル時間 592 ms
コンパイル使用メモリ 64,000 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-25 14:04:58
合計ジャッジ時間 1,640 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

int main(void){
  int it=0;
  int ir=0;
  int ie=0;
  int x=0;
  std::string a;
  std::cin >> a;
  const char* ca = a.c_str();
  for(int i=0;i<a.length();i++){
    if(ca[i]=='t') it++;
    if(ca[i]=='r') ir++;
    if(ca[i]=='e') ie++;
  }
  //std::cout << it << " " << ir << " " << ie <<std::endl;
  if(it<=ie/2){
    if(ir>=it) x=it;
    else x=ir;
  }
  else x=ie/2;
  std::cout << x << std::endl;
}
0