結果
| 問題 | 
                            No.1005 BOT対策
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-08-02 10:06:55 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 382 bytes | 
| コンパイル時間 | 1,689 ms | 
| コンパイル使用メモリ | 168,968 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-23 03:00:19 | 
| 合計ジャッジ時間 | 2,632 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 25 WA * 2 | 
ソースコード
#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();
        }else i++;
    }
    if(t.size() == 1 && ans >= 1){
        cout << -1 << endl;
        return 0;
    }
    cout << ans << endl;
}