結果

問題 No.430 文字列検索
ユーザー ldsyb
提出日時 2017-07-20 02:01:31
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 289 ms / 2,000 ms
コード長 327 bytes
コンパイル時間 1,011 ms
コンパイル使用メモリ 80,064 KB
実行使用メモリ 32,128 KB
最終ジャッジ日時 2024-11-10 00:17:20
合計ジャッジ時間 2,996 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
using namespace std;

int main(){
	map<string, int> mp;
	string s;
	int n;
	cin >> s >> n;
	for(int i = 0; i < s.size(); i++) for(int j = 1; j <= 10; j++) if(i + j <= s.size()) mp[s.substr(i, j)]++;
	int ans = 0;
	while(n--){
		string t;
		cin >> t;
		ans += mp[t];
	}
	cout << ans << endl;
}
0