結果
問題 | No.1005 BOT対策 |
ユーザー |
![]() |
提出日時 | 2021-02-21 15:24:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 415 bytes |
コンパイル時間 | 3,233 ms |
コンパイル使用メモリ | 194,876 KB |
実行使用メモリ | 7,848 KB |
最終ジャッジ日時 | 2025-06-20 01:28:52 |
合計ジャッジ時間 | 4,380 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#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; }