結果
| 問題 | No.430 文字列検索 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-12 04:47:44 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1,466 ms / 2,000 ms |
| + 549µs | |
| コード長 | 443 bytes |
| 記録 | |
| コンパイル時間 | 300 ms |
| コンパイル使用メモリ | 75,804 KB |
| 実行使用メモリ | 9,896 KB |
| 最終ジャッジ日時 | 2026-09-21 16:28:19 |
| 合計ジャッジ時間 | 10,518 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge4_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 14 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
int count(string src, string ptn) {
int ret = 0;
size_t idx = src.find(ptn, 0);
while ( idx != string::npos ) {
++ret;
idx = src.find(ptn, idx + 1);
}
return ret;
}
int main () {
string s;
int m;
cin >> s;
cin >> m;
string c;
int sum = 0;
for (int i = 0; i < m; i++) {
cin >> c;
sum += count(s, c);
}
cout << sum << endl;
return 0;
}