結果
| 問題 |
No.725 木は明らかに森である
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-02-11 00:35:44 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 477 bytes |
| コンパイル時間 | 127 ms |
| コンパイル使用メモリ | 23,808 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-10-01 07:12:27 |
| 合計ジャッジ時間 | 585 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 4 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%s",str);
| ~~~~~^~~~~~~~~~
ソースコード
#include <cstdio>
#include <cstring>
int main(){
const char Tree[8]="treeone";
char str[100+1];
scanf("%s",str);
for(int pos=0;pos<strlen(str);pos++){
int k=0;
for(;pos+k<strlen(str) && k<7;k++){
if(str[pos+k]!=Tree[k])break;
}
if(k==7){
printf("forest");pos+=7-1;
}else{
for(int l=0;l<=k;l++)printf("%c",str[pos+l]);
pos+=k;
}
}printf("\n");
return 0;
}