結果

問題 No.725 木は明らかに森である
ユーザー kikagekikage
提出日時 2020-02-11 00:35:44
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 477 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 24,064 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2024-04-08 14:26:31
合計ジャッジ時間 957 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,548 KB
testcase_01 AC 0 ms
6,548 KB
testcase_02 WA -
testcase_03 AC 1 ms
6,548 KB
testcase_04 AC 1 ms
6,548 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 0 ms
6,548 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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);
      |     ~~~~~^~~~~~~~~~

ソースコード

diff #

#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;
}

0