結果
| 問題 |
No.430 文字列検索
|
| コンテスト | |
| ユーザー |
くれちー
|
| 提出日時 | 2016-10-02 23:59:33 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 437 bytes |
| コンパイル時間 | 863 ms |
| コンパイル使用メモリ | 21,248 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-10 00:05:50 |
| 合計ジャッジ時間 | 4,338 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 5 RE * 9 |
コンパイルメッセージ
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]);
| ^~~~~~~~~~~~~~~~~
ソースコード
#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;
}
くれちー