結果
| 問題 | No.430 文字列検索 |
| コンテスト | |
| ユーザー |
ebicochineal
|
| 提出日時 | 2016-10-22 01:34:37 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1,859 ms / 2,000 ms |
| コード長 | 461 bytes |
| 記録 | |
| コンパイル時間 | 784 ms |
| コンパイル使用メモリ | 55,900 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-10 00:11:31 |
| 合計ジャッジ時間 | 12,745 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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