結果

問題 No.725 木は明らかに森である
ユーザー card_board01card_board01
提出日時 2018-09-24 15:32:33
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 412 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 27,712 KB
実行使用メモリ 10,472 KB
最終ジャッジ日時 2023-10-22 02:29:19
合計ジャッジ時間 6,612 ms
ジャッジサーバーID
(参考情報)
judge14 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'main':
main.c:15:23: warning: passing argument 2 of 'strstr' makes pointer from integer without a cast [-Wint-conversion]
   15 |         p = strstr(a, *goal);
      |                       ^~~~~
      |                       |
      |                       char
In file included from main.c:2:
/usr/include/string.h:350:58: note: expected 'const char *' but argument is of type 'char'
  350 | extern char *strstr (const char *__haystack, const char *__needle)
      |                                              ~~~~~~~~~~~~^~~~~~~~

ソースコード

diff #

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

int main(void) {
    char a[101];
    char read[8];
    char *goal = "treeone";
    char *input = "forest";
    
    char *p;
    
    scanf("%s", a);
    
    for (int i = 0; i < 100; i++) {
        p = strstr(a, *goal);
        
        do {
            *(p++) = *(input++);
        }  while(*(goal) != '\0');
        
        *(p + 7) = '\0';
    }
    
    return 0;
}
0