結果
問題 | No.430 文字列検索 |
ユーザー | DialBird |
提出日時 | 2016-10-20 14:07:54 |
言語 | C90 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 719 ms / 2,000 ms |
コード長 | 586 bytes |
コンパイル時間 | 227 ms |
コンパイル使用メモリ | 20,736 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-05-03 04:44:35 |
合計ジャッジ時間 | 4,876 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 0 ms
5,248 KB |
testcase_01 | AC | 22 ms
5,376 KB |
testcase_02 | AC | 494 ms
5,376 KB |
testcase_03 | AC | 379 ms
5,376 KB |
testcase_04 | AC | 1 ms
5,376 KB |
testcase_05 | AC | 0 ms
5,376 KB |
testcase_06 | AC | 1 ms
5,376 KB |
testcase_07 | AC | 0 ms
5,376 KB |
testcase_08 | AC | 1 ms
5,376 KB |
testcase_09 | AC | 1 ms
5,376 KB |
testcase_10 | AC | 1 ms
5,376 KB |
testcase_11 | AC | 296 ms
5,376 KB |
testcase_12 | AC | 304 ms
5,376 KB |
testcase_13 | AC | 297 ms
5,376 KB |
testcase_14 | AC | 397 ms
5,376 KB |
testcase_15 | AC | 719 ms
5,376 KB |
testcase_16 | AC | 564 ms
5,376 KB |
testcase_17 | AC | 531 ms
5,376 KB |
コンパイルメッセージ
main.c: In function ‘main’: main.c:17:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 17 | fscanf(stdin, "%s", S); | ^~~~~~~~~~~~~~~~~~~~~~ main.c:18:3: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 18 | fscanf(stdin, "%d", &M); | ^~~~~~~~~~~~~~~~~~~~~~~ main.c:24:5: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 24 | fscanf(stdin, "%s", str); | ^~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <stdlib.h> #include <string.h> static void *xmalloc(size_t size){ void *m = malloc(size); if (!m) { perror("malloc()"); exit(1); } return m; } int main(int argc, char *argv[]){ char *S = (char*)xmalloc(50001); int M; fscanf(stdin, "%s", S); fscanf(stdin, "%d", &M); int i; char *point; char str[11]; int count = 0; for (i=0;i<M;i++) { fscanf(stdin, "%s", str); point = S; while ((point = strstr(point, str)) != NULL) { count++; point += 1; } } free(S); printf("%d\n", count); exit(0); }