結果

問題 No.279 木の数え上げ
ユーザー sasa
提出日時 2025-03-11 16:24:49
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 366 bytes
コンパイル時間 350 ms
コンパイル使用メモリ 28,416 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-11 16:24:51
合計ジャッジ時間 1,239 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%s", s);
      |         ~~~~~^~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<string.h>
int main()
{
	char s[1000006];
	scanf("%s", s);
	int i, n = strlen(s);
	int t, r, e;
	t = r = e = 0;
	for(i = 0; i < n; i++)
	{
		if(s[i] == 't'){
			t++;
		}else if(s[i] == 'r'){
			r++;
		}else if(s[i] == 'e'){
			e++;
		}
	}
	int ans = t;
	if(ans > r){
		ans = r;
	}
	if(ans > e / 2){
		ans = e / 2;
	}
	printf("%d\n", ans);
}
0