結果

問題 No.430 文字列検索
ユーザー ohreitetsu
提出日時 2018-06-26 21:42:55
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 663 ms / 2,000 ms
コード長 411 bytes
コンパイル時間 431 ms
コンパイル使用メモリ 63,488 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-10 00:19:21
合計ジャッジ時間 4,771 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <string.h>
using namespace std;
int main(int argc, char* argv[])
{
	int ans=0;
	string S,C;
	cin>>S;
	char *pStr;
	int M;
	cin>>M;
	int i;
	for (i=0;i<M;i++){
		cin>>C;
		pStr=(char*)S.c_str();
		char *q=(char*)C.c_str();
		while (true){
			char *p=strstr(pStr,q);
			if (p){
				ans++;
				pStr=p+1;
			}else{
				break;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}
0