結果

問題 No.430 文字列検索
ユーザー Kmcode1Kmcode1
提出日時 2016-10-02 22:33:03
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 273 ms / 2,000 ms
コード長 403 bytes
コンパイル時間 1,320 ms
コンパイル使用メモリ 153,656 KB
実行使用メモリ 32,344 KB
最終ジャッジ日時 2023-08-15 17:20:27
合計ジャッジ時間 3,447 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 273 ms
32,344 KB
testcase_02 AC 22 ms
4,376 KB
testcase_03 AC 25 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 263 ms
31,960 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 19 ms
6,484 KB
testcase_11 AC 130 ms
8,552 KB
testcase_12 AC 136 ms
8,716 KB
testcase_13 AC 137 ms
8,496 KB
testcase_14 AC 104 ms
6,512 KB
testcase_15 AC 85 ms
5,444 KB
testcase_16 AC 38 ms
4,376 KB
testcase_17 AC 29 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

map<string, int> mp;
string s;
int m;
char buf[100002];
int main(){
	cin >> s;
	for (int i = 0; i < s.size(); i++){
		for (int j = 0; j < 10; j++){
			if (i + j >= s.size()){
				break;
			}
			mp[s.substr(i, j + 1)]++;
		}
	}
	int ans = 0;
	cin >> m;
	for (int i = 0; i < m; i++){
		scanf("%s", buf);
		ans += mp[buf];
	}
	cout << ans << endl;
	return 0;
}
0