結果
問題 | No.1005 BOT対策 |
ユーザー |
|
提出日時 | 2022-08-02 10:08:32 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 406 bytes |
コンパイル時間 | 1,398 ms |
コンパイル使用メモリ | 163,124 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-06-20 01:39:47 |
合計ジャッジ時間 | 2,497 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ string s, t; cin >> s >> t; int ans = 0; for(int i = 0; i + t.size() <= s.size();){ if(s.substr(i, t.size()) == t){ ans++; i += t.size() - 1; if(t.size() == 1){ cout << -1 << endl; return 0; } }else i++; } cout << ans << endl; }