結果

問題 No.1005 BOT対策
ユーザー ei13337ei13337
提出日時 2020-03-06 22:50:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 467 bytes
コンパイル時間 1,874 ms
コンパイル使用メモリ 164,924 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-22 11:31:22
合計ジャッジ時間 3,581 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 RE -
testcase_05 AC 1 ms
6,948 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 WA -
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 2 ms
6,944 KB
testcase_22 AC 2 ms
6,944 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 2 ms
6,944 KB
testcase_25 AC 2 ms
6,940 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 RE -
testcase_28 WA -
testcase_29 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main() {
  string s, t;
  cin >> s >> t;
  int n = (int)s.size(), m = (int)t.size();
  if(m == 1) {
    assert(false);
    for(int i = 0; i < n; i++) if(s[i] == t[0]) {
      cout << -1 << endl;
      return 0;
    }
    cout << 0 << endl;
    return 0;
  }
  int ans = 0;
  for(int i = 0; i + m <= n; i++) {
    if(s.substr(i, m) == t) {
      ans++;
      i += m - 1;
    }
  }
  cout << ans << endl;
  return 0;
}
0