結果
問題 |
No.430 文字列検索
|
ユーザー |
|
提出日時 | 2020-04-17 01:02:32 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,365 ms / 2,000 ms |
コード長 | 881 bytes |
コンパイル時間 | 219 ms |
コンパイル使用メモリ | 32,896 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-10 00:42:40 |
合計ジャッジ時間 | 10,982 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 14 |
ソースコード
/* * FileName: string_search * CreatedDate: 2020-04-17 00:49:10 +0900 * LastModified: 2020-04-17 01:02:02 +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); if(strlen(s)<strlen(string)){ continue; } 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; }