結果

問題 No.1005 BOT対策
コンテスト
ユーザー ui_mtc
提出日時 2020-03-30 14:05:22
言語 C++14
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
+ 766µs
コード長 435 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,020 ms
コンパイル使用メモリ 187,680 KB
実行使用メモリ 9,908 KB
最終ジャッジ日時 2026-11-06 00:37:45
合計ジャッジ時間 2,989 ms
ジャッジサーバーID
(参考情報)
judge7_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#define int long long 
using namespace std;
using Graph = vector<vector<int>>;

signed main(){
  string S, T;
  cin >> S >> T;
  
  int ans = 0;
  int N = (int)T.size();
  int cnt = 0;
  while( cnt < S.size() ){
    if( S.substr(cnt, N) == T ){
      if( N==1 ){
        cout << -1 << endl;
        return 0;
      }else{
        ans++;
        cnt += N-1;
      }
    }else cnt++;
  }
  cout << ans << endl;
}
0