結果
問題 | No.1005 BOT対策 |
ユーザー |
![]() |
提出日時 | 2020-03-30 14:05:22 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 435 bytes |
コンパイル時間 | 1,374 ms |
コンパイル使用メモリ | 163,208 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-06-20 00:51:40 |
合計ジャッジ時間 | 2,455 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <bits/stdc++.h> #define int long long using namespace std; using Graph = vector<vector<int>>; signed main(){ string S, T; cin >> S >> T; int ans = 0; int N = (int)T.size(); int cnt = 0; while( cnt < S.size() ){ if( S.substr(cnt, N) == T ){ if( N==1 ){ cout << -1 << endl; return 0; }else{ ans++; cnt += N-1; } }else cnt++; } cout << ans << endl; }