結果

問題 No.725 木は明らかに森である
ユーザー Maeda
提出日時 2025-03-27 16:42:11
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 409 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 24,960 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-03-27 16:42:13
合計ジャッジ時間 1,155 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |     scanf("%s",str);
      |     ^~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <string.h>

void main(void){
    char str[500] = "a";
    scanf("%s",str);
    int i = 0;
    while(str[i] != '\0'){
        char search[10] = "";
        strncpy(search, str+i, 7);
        search[8] = '\0';
        if(strcmp(search,"treeone") == 0){
            printf("forest");
            i+=7;
        }else{
            printf("%c",str[i]);
            i++;
        }
    }
}
0