結果

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

ソースコード

diff #

#include <stdio.h>
int main(void){
	char str[10000000];
	scanf("%s",str);
	
	int count[3];
	for(int i = 0;i < 10000000;i++){
		if(str[i] == 't'){
			count[0]++;
		}else if(str[i] == 'r'){
			count[1]++;
		}else if(str[i] == 'e'){
			count[2]++;
		}
	}
	count[2] /= 2;
	// ソート
	for(int i = 0;i < 3;i++){
		for(int j = 0;j < 3;j++){
			if(count[i] > count[j]){
				int tmp = count[i];
				count[i] = count[j];
				count[j] = tmp;
			}
		}
	}
	printf("%d",count[2]);
}
0