結果

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

ソースコード

diff #

#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))

#define MOD 1000000007

// 愚直解(想定誤解法)

string s;

int main(){
  cin>>s;
  int m;
  cin>>m;
  int ans = 0;
  rep(i,0,m){
    string s1;
    cin>>s1;
    rep(i,0,max(0,(int)(s.sz-s1.sz)+1)){
      int flag = 1;
      rep(j,0,s1.sz){
        if(s[i+j]!=s1[j]){
          flag = 0;
          break;
        }
      }
      if(flag == 1)ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
0