結果
問題 | No.1005 BOT対策 |
ユーザー |
![]() |
提出日時 | 2020-03-06 21:54:43 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 614 bytes |
コンパイル時間 | 1,459 ms |
コンパイル使用メモリ | 167,084 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2024-10-14 10:35:39 |
合計ジャッジ時間 | 4,855 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 1 TLE * 1 -- * 25 |
ソースコード
#include<bits/stdc++.h> #define REP(i,x) for(int i=0,i##_len=(x);i<i##_len;++i) #define rep(i,a,b) for(int i=(a),i##_len(b);i<i##_len;++i) #define All(x) begin(x),end(x) #define rAll(x) rbegin(x),rend(x) using namespace std; using ll = long long; int main(){ string s,t; cin>>s>>t; assert(s.size()<=1000); assert(t.size()<=1000); if(t.size()==1&&s.find(t.front())){ cout<<-1<<endl; return 0; } int ans=0; for(int i=0;i+t.size()<=s.size();++i){ if(s.substr(i,t.size())==t){ ans++; i+=t.size()-2; } } cout<<ans<<endl; }