結果

問題 No.2862 NOT FOUND 404
コンテスト
ユーザー tsuda213
提出日時 2025-11-10 14:39:46
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 394 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 26,316 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-11-10 14:39:48
合計ジャッジ時間 1,231 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |   scanf("%d", &n);
      |   ^~~~~~~~~~~~~~~
main.c:13:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |   scanf("%s", s);
      |   ^~~~~~~~~~~~~~

ソースコード

diff #

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

int main(void)
{
  int n;
  char *s;
  scanf("%d", &n);

  s = (char*)malloc(n*sizeof(char)+1);

  scanf("%s", s);

  while(s[2] != '\0') {
    char tmp;
    tmp = s[3];
    s[3] = '\0';
    if (strcmp("404", s) == 0) {
      printf("Found\n");
      return 0;
    }
    s[3] = tmp;
    s++;
  }

  printf("NotFound\n");
  return 0;
}
0