結果

問題 No.430 文字列検索
ユーザー treeonetreeone
提出日時 2016-10-02 22:57:38
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 657 bytes
コンパイル時間 1,185 ms
コンパイル使用メモリ 146,356 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-08-13 17:17:15
合計ジャッジ時間 18,365 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 381 ms
4,376 KB
testcase_02 TLE -
testcase_03 AC 1,428 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 4 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 1,865 ms
4,376 KB
testcase_12 AC 1,861 ms
4,376 KB
testcase_13 AC 1,863 ms
4,376 KB
testcase_14 AC 1,864 ms
4,508 KB
testcase_15 AC 1,731 ms
4,380 KB
testcase_16 AC 1,272 ms
4,380 KB
testcase_17 AC 1,240 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;

signed main(){
    string s;
    cin >> s;
    s += '!';
    int m;
    cin >> m;
    vector<string> c(m);
    rep(i, 0, m){
        cin >> c[i];
    }
    int ans = 0;
    rep(i, 0, m){
        int now = 0;
        rep(j, 0, s.size()){
            rep(k, 0, c[i].size()){
                if(s[j + k] != c[i][k]) break;
                if(k == c[i].size() - 1) ans++;
            }
        }
        // cout << ans << endl;
    }
    cout << ans << endl;
}
0