結果

問題 No.430 文字列検索
ユーザー ヒッキープログラミングするスレヒッキープログラミングするスレ
提出日時 2016-10-03 00:09:46
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 412 bytes
コンパイル時間 470 ms
コンパイル使用メモリ 64,416 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-15 17:32:52
合計ジャッジ時間 13,057 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 154 ms
4,376 KB
testcase_02 TLE -
testcase_03 AC 1,048 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 714 ms
4,380 KB
testcase_12 AC 726 ms
4,376 KB
testcase_13 AC 728 ms
4,380 KB
testcase_14 AC 1,209 ms
4,380 KB
testcase_15 AC 1,407 ms
4,380 KB
testcase_16 AC 1,896 ms
4,376 KB
testcase_17 AC 1,952 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    string s;
    cin >> s;
    
    int m;
    cin >> m;
    
    int ans(0);
    
    for (int i = 0; i < m; i++) {
        string c;
        cin >> c;
        size_t x = s.find(c);
        while (x != string::npos) {
            ans++;
            x = s.find(c, x + 1);
        }
    }
    
    cout << ans << endl;
    
    return 0;
}
0