結果

問題 No.430 文字列検索
ユーザー conf
提出日時 2016-10-02 22:57:14
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 444 bytes
コンパイル時間 680 ms
コンパイル使用メモリ 66,352 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-10 00:02:39
合計ジャッジ時間 1,870 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    string S;
    int M;
    cin>>S;
    cin>>M;
    set<string> C;
    for(int i=0;i<M;i++){
        string c;
        cin>>c;
        C.insert(c);
    }
    int ans=0;
    for(int l=1;l<=10;l++){
        for(int i=0;i+l<=S.size();i++){
            if(C.find(S.substr(i,l))!=C.end()){
                ans++;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}
0