結果

問題 No.279 木の数え上げ
ユーザー syakebanana832syakebanana832
提出日時 2017-06-12 17:28:26
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 344 bytes
コンパイル時間 185 ms
コンパイル使用メモリ 23,984 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 21:36:18
合計ジャッジ時間 1,709 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<stdio.h>
#include<string.h>
int main()
{
	char s[1000000];
	int n,i,t,r,e,f;
	
	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