結果

問題 No.1005 BOT対策
ユーザー yukileo9
提出日時 2021-07-15 08:55:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 513 bytes
コンパイル時間 1,434 ms
コンパイル使用メモリ 168,308 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-04 09:11:37
合計ジャッジ時間 2,506 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

void no_1005(void) {
    string s, t;
    cin >> s >> t;
    int t_size = (int)t.size();
    int tcnt = 0;
    int ptr = 0;
    while (true) {
        string s_tmp = s.substr(ptr, t_size);
        if (s_tmp == t) {
            tcnt++;
            ptr += t_size;
        } else
            ptr++;
        if (ptr >= (int)s.size() - t_size + 1) break;
    }
    if (t.size() == 1) tcnt = -1;
    cout << tcnt << endl;
}

int main(void) {
    no_1005();
    return 0;
}
0