結果
| 問題 | 
                            No.1005 BOT対策
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-06-23 21:28:23 | 
| 言語 | C++17(clang)  (17.0.6 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 508 bytes | 
| コンパイル時間 | 1,023 ms | 
| コンパイル使用メモリ | 130,776 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-11-30 18:43:17 | 
| 合計ジャッジ時間 | 1,762 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 25 WA * 2 | 
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <climits>
#include <map>
#include <queue>
using namespace std;
int main() {
    string s,t;
    cin >> s >> t;
    if (t.size() == 1 && s.find(t)!=string::npos) {
        cout << -1 << endl;
        return 0;
    }
    const int n = s.size();
    const int c = t.size();
    int ans = 0;
    for (int i=0; i<n; i++) {
        if (t == s.substr(i, c)) ans++, i+=c-1;
    }
    cout << ans << endl;
}