結果
| 問題 | No.430 文字列検索 |
| コンテスト | |
| ユーザー |
ebicochineal
|
| 提出日時 | 2016-10-22 01:34:37 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1,659 ms / 2,000 ms |
| コード長 | 461 bytes |
| 記録 | |
| コンパイル時間 | 521 ms |
| コンパイル使用メモリ | 71,532 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2026-05-09 09:00:21 |
| 合計ジャッジ時間 | 13,046 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 14 |
ソースコード
#include <iostream>
using namespace std;
int f(string s, string t) {
int p = 0, cnt = 0;
while (1) {
p = s.find(t);
if (p >= 0) {
++cnt;
s.erase(0, p+1);
} else {
break;
}
}
return cnt;
}
int main() {
string s, t; int ans = 0, m;
cin >> s >> m;
for (int i = 0; i < m; ++i) {
cin >> t;
ans += f(s, t);
}
cout << ans << endl;
return 0;
}
ebicochineal