結果

問題 No.430 文字列検索
ユーザー はむ吉🐹はむ吉🐹
提出日時 2016-10-03 22:27:10
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 569 bytes
コンパイル時間 675 ms
コンパイル使用メモリ 56,648 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-03 04:33:24
合計ジャッジ時間 13,994 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 158 ms
5,376 KB
testcase_02 TLE -
testcase_03 AC 1,068 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 704 ms
5,376 KB
testcase_12 AC 710 ms
5,376 KB
testcase_13 AC 741 ms
5,376 KB
testcase_14 AC 1,285 ms
5,376 KB
testcase_15 AC 1,552 ms
5,376 KB
testcase_16 TLE -
testcase_17 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdlib>
#include <iostream>
#include <string>
#pragma GCC optimize ("-O3")


int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::string s;
    std::cin >> s;
    int m;
    std::cin >> m;
    long long answer = 0;
    for (auto i = 0; i < m; i++)
    {
        std::string c;
        std::cin >> c;
        auto pos = s.find(c, 0);
        while (pos != std::string::npos)
        {
            answer++;
            pos = s.find(c, pos + 1);
        }
    }
    std::cout << answer << std::endl;
    return EXIT_SUCCESS;
}
0