結果

問題 No.430 文字列検索
ユーザー task4233
提出日時 2018-04-01 19:58:21
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 1,253 bytes
コンパイル時間 1,230 ms
コンパイル使用メモリ 161,116 KB
実行使用メモリ 8,576 KB
最終ジャッジ日時 2024-11-10 00:19:16
合計ジャッジ時間 4,573 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 4
other AC * 1 TLE * 1 -- * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

// ------------------------------------
// Date:2018/ 4/ 1
// Problem:No.493 とても長い数列と文字列 / 0493.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  SCIN(S);
  CIN(M);
  vector< string > C(M);
  REP(i, M)
    cin >> C[i];

  ll ans = 0ll;
  REP(i, M) {
    REP(j, S.size()) {
      string tmp = S.substr(j, C[i].size());
      if (tmp == C[i]) ans++;
    }
  }

  cout << ans << endl;
  

  return 0;
}

0