結果
| 問題 |
No.279 木の数え上げ
|
| コンテスト | |
| ユーザー |
syakebanana832
|
| 提出日時 | 2017-06-12 17:28:26 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 344 bytes |
| コンパイル時間 | 137 ms |
| コンパイル使用メモリ | 23,680 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-24 16:47:14 |
| 合計ジャッジ時間 | 998 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 8 WA * 13 |
コンパイルメッセージ
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;
| ^
ソースコード
#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;
}
syakebanana832