結果

問題 No.279 木の数え上げ
ユーザー syakebanana832syakebanana832
提出日時 2017-06-12 17:30:06
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 334 bytes
コンパイル時間 129 ms
コンパイル使用メモリ 23,324 KB
実行使用メモリ 8,696 KB
最終ジャッジ日時 2023-10-24 21:36:24
合計ジャッジ時間 3,806 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,616 KB
testcase_01 AC 0 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 0 ms
4,348 KB
testcase_05 AC 0 ms
4,348 KB
testcase_06 AC 0 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 0 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:17: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘char (*)[1000000]’ [-Wformat=]
    7 |         scanf("%s",&s);
      |                ~^  ~~
      |                 |  |
      |                 |  char (*)[1000000]
      |                 char*
main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%s",&s);
      |         ~~~~~^~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<string.h>
char s[1000000];
int n,i,t,r,e;
int main()
{	
	scanf("%s",&s);
	for(i=0;i<strlen(s);i++){
		if(s[i]=='t'){
			t++;
		}
		if(s[i]=='r'){
			r++;
		}
		if(s[i]=='e'){
				e++;
		}
	}
	while(1){
		if(t==0||r==0||e<=1){
			break;
		}
			n++;
			t--;
			r--;
			e-=2;
	}
	printf("%d\n",n);
	return 0;
}
0