結果

問題 No.279 木の数え上げ
コンテスト
ユーザー Haijinn
提出日時 2017-08-05 16:17:56
言語 C11(gcc12 gnu拡張)
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=gnu11 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 474 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 103 ms
コンパイル使用メモリ 32,904 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-03-08 16:13:06
合計ジャッジ時間 918 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:13:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 | scanf("%s",s);
      | ^~~~~~~~~~~~~

ソースコード

diff #
raw source code

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<time.h>
int main(){
	int a=0;
	int c=0;
	int b=0;
	int d=0;
	int i;
	
char s[1000010];
scanf("%s",s);
//printf("!%s\n",s);
for(i=0;i<strlen(s);i++){
	
		if(s[i]=='t'){
			
			a++;
		}
		if(s[i]=='r'){
			
			b++;
			
		}
		if(s[i]=='e'){
			
			
			c++;
			
		}
		
	
}
for(i=0;i<strlen(s);i++){
	if(a>=1&&b>=1&&c>=2){
		a--;
		b--;
		c-=2;
		
		d++;
		
		
		
		
	}
	
	
	
	
	
	
}
printf("%d\n",d);
	return 0;
}
0