結果
問題 | No.1005 BOT対策 |
ユーザー |
![]() |
提出日時 | 2021-02-21 15:24:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 415 bytes |
コンパイル時間 | 2,158 ms |
コンパイル使用メモリ | 194,176 KB |
最終ジャッジ日時 | 2025-01-19 03:01:11 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define rep(i,n) for(int i=0;i<n;i++)typedef long long ll;int main() {string s,t;cin>>s;cin>>t;int slen=s.size();int tlen=t.size();int cnt=0;rep(i,slen-tlen+1){if(s.substr(i,tlen)==t){cnt++;if(tlen>2) i+=tlen-1;}}if(t.size()==1 && cnt>0){cout<<-1<<endl;return 0;}cout<<cnt<<endl;return 0;}