結果
| 問題 | 
                            No.1005 BOT対策
                             | 
                    
| コンテスト | |
| ユーザー | 
                             onsen_manjuuu
                         | 
                    
| 提出日時 | 2020-06-14 18:33:41 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 526 bytes | 
| コンパイル時間 | 1,790 ms | 
| コンパイル使用メモリ | 167,632 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-27 15:49:43 | 
| 合計ジャッジ時間 | 2,594 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 25 WA * 2 | 
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    string s, t; cin >> s >> t;
    if((int)t.size() == 1) {
        if(count(s.begin(), s.end(), t.front())) {
            cout << -1 << endl;
        } else {
            cout << 0 << endl;
        }
            return 0;
    }
    int n = s.size(), m = t.size();
    int ans = 0;
    for(int i = 0; i < n-m+1; i++) {
        if(t == s.substr(i, m)) {
            ans ++;
            i += m - 1;
        }
    }   
    cout << ans << endl;
}
            
            
            
        
            
onsen_manjuuu