結果
| 問題 | No.279 木の数え上げ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-03-17 22:40:13 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 673 bytes |
| 記録 | |
| コンパイル時間 | 842 ms |
| コンパイル使用メモリ | 62,564 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-29 21:32:04 |
| 合計ジャッジ時間 | 2,020 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 |
ソースコード
#include <stdio.h>
#include <string>
#include <algorithm>
int main(){
//input
char S[1000001];
scanf("%s",S);
//count 't','r','e'
int count_t = 0;
int count_r = 0;
int count_e = 0;
for (int i = 0;i < 1000001;i++){
if (S[i] != '\0'){
if (S[i] == 't') count_t++;
if (S[i] == 'r') count_r++;
if (S[i] == 'e') count_e++;
}else{
break;
}
}
//count 'tr','ee','tree'
int count_tr = std::min(count_t,count_r);
int count_ee = (count_e-count_e%2)/2;
int count_tree = std::min(count_tr,count_ee);
//output
printf("%d\n",count_tree);
return 0;
}