結果

問題 No.279 木の数え上げ
コンテスト
ユーザー umashika
提出日時 2016-01-31 02:36:21
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 535 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 312 ms
コンパイル使用メモリ 38,360 KB
最終ジャッジ日時 2026-02-23 20:25:43
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<stdio.h>
#include<string.h>

int main(void){
  char s[1000000];
  int i;
  int num_t=0;
  int num_r=0;
  int num_e=0;
  int num_tree=0;

  scanf("%s",s);

  //抽出
  for(i=0;i<strlen(s);i++){
    switch(s[i]){
    case 't':num_t++;break;
    case 'r':num_r++;break;
    case 'e':num_e++;break;
    default:break;
    }
  }

  //木が何個作れるか
  for(i=0;i<num_t;i++){
    if(num_r>0 && num_e/2>0){
      num_tree++;
      num_r--;
      num_e-=2;
    }
    else{break;}
  }
  printf("%d\n",num_tree);
  return 0;
}
0