結果
| 問題 | No.430 文字列検索 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-17 01:03:30 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 907 bytes |
| 記録 | |
| コンパイル時間 | 327 ms |
| コンパイル使用メモリ | 32,768 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-10 00:42:57 |
| 合計ジャッジ時間 | 15,991 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 13 TLE * 1 |
ソースコード
/*
* FileName: string_search
* CreatedDate: 2020-04-17 00:49:10 +0900
* LastModified: 2020-04-17 01:03:19 +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)){
free(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;
}