結果
| 問題 |
No.430 文字列検索
|
| コンテスト | |
| ユーザー |
くれちー
|
| 提出日時 | 2016-10-03 00:14:35 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 444 bytes |
| コンパイル時間 | 215 ms |
| コンパイル使用メモリ | 20,992 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-10 00:06:37 |
| 合計ジャッジ時間 | 13,516 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 13 RE * 1 |
コンパイルメッセージ
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() {
static char s[50001], c[5000][11];
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;
}
くれちー