結果
問題 |
No.1005 BOT対策
|
ユーザー |
![]() |
提出日時 | 2020-07-05 17:50:32 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 632 bytes |
コンパイル時間 | 802 ms |
コンパイル使用メモリ | 81,684 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-06-20 00:53:25 |
合計ジャッジ時間 | 1,709 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <vector> #include <iostream> #include <algorithm> #include <functional> #include <string> #include <math.h> #include <map> using namespace std; int main(){ string s,t; cin >> s >> t; if(t.size()>s.size()){ cout << 0 << endl; return 0; } int ans=0; while(1){ int cnt=0; for(int i=0;i<=s.size();i++){ if(s.substr(i,t.size())==t){ if(t.size()==1){ cout << -1 << endl; return 0; }else{ s.insert(i+t.size()-1,"."); cnt++; //cout << s << endl; i+=t.size()-1; //cout << i << endl; } } } if(cnt==0)break; ans+=cnt; } cout << ans << endl; return 0; }