結果

問題 No.430 文字列検索
ユーザー くれちーくれちー
提出日時 2016-10-02 23:59:33
言語 C90
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 437 bytes
コンパイル時間 483 ms
コンパイル使用メモリ 21,120 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-01 11:00:19
合計ジャッジ時間 12,724 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 382 ms
5,376 KB
testcase_02 RE -
testcase_03 RE -
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 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 RE -
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1,500 ms
5,376 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%s %d", s, &m);
      |         ^~~~~~~~~~~~~~~~~~~~~
main.c:10:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |                 scanf("%s", c[i]);
      |                 ^~~~~~~~~~~~~~~~~

ソースコード

diff #

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

int main() {
	char s[50001], c[5000][10];
	int m, i, j, k, f, cnt = 0;

	scanf("%s %d", s, &m);
	for (i = 0; i < m; i++) {
		scanf("%s", c[i]);
		for (j = 0; j < strlen(s) - (strlen(c[i]) - 1); j++) {
			f = 0;
			for (k = 0; k < strlen(c[i]); k++) {
				if (s[j + k] == c[i][k]) f = 1;
				else {
					f = 0;
					break;
				}
			}
			if (f == 1) cnt++;
		}
	}

	printf("%d\n", cnt);
	return 0;
}
0