結果

問題 No.1005 BOT対策
ユーザー monnumonnu
提出日時 2020-05-26 00:00:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 933 bytes
コンパイル時間 1,502 ms
コンパイル使用メモリ 162,716 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-21 03:59:59
合計ジャッジ時間 2,374 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<pair<int,int>>>;
#define INF 1000000000000000000
#define MOD 1000000007

int main(){
  string S,T;
  cin>>S>>T;
  if(T.size()==1){
    bool flag=true;
    for(int i=0;i<S.size();i++){
      if(S.at(i)==T.at(0)){
        flag=false;
      }
    }
    if(flag){
      cout<<0<<endl;
    }else{
      cout<<-1<<endl;
    }
  }else{
    int ans=0;
    bool flag=false;
    int j=0;
    for(int i=0;i<S.size();i++){
      if(!flag){
        if(S.at(i)==T.at(0)){
          flag=true;
          j=1;
        }
      }else{
        if(S.at(i)==T.at(j)){
          j++;
          if(j==T.size()){
            ans++;
            flag=false;
            j=0;
            if(S.at(i)==T.at(0)){
              flag=true;
              j=1;
            }
          }
        }else{
          flag=false;
        }
      }
    }
    cout<<ans<<endl;
  }
}
0