結果
問題 |
No.430 文字列検索
|
ユーザー |
|
提出日時 | 2020-04-17 00:57:53 |
言語 | C (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 811 bytes |
コンパイル時間 | 720 ms |
コンパイル使用メモリ | 29,056 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-10 00:42:41 |
合計ジャッジ時間 | 12,161 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 13 RE * 1 |
ソースコード
/* * FileName: string_search * CreatedDate: 2020-04-17 00:49:10 +0900 * LastModified: 2020-04-17 00:57:14 +0900 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #define str_max 50000 int main(void){ char *s=(char *)calloc(str_max,sizeof(char)); scanf("%s",s); int m; scanf("%d",&m); int count=0,j,k; for(int i=0;i<m;i++){ char *string = (char*)calloc(10,sizeof(char)); scanf("%s",string); for(j=0;j<strlen(s)-strlen(string)+1;j++){ for(k=0;k<strlen(string);k++){ if(s[j+k]!=string[k]){ break; } } if(k==strlen(string)){ count++; } } free(string); } printf("%d\n",count); free(s); return 0; }