結果

問題 No.1005 BOT対策
ユーザー take000
提出日時 2021-03-31 05:04:42
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 576 bytes
コンパイル時間 2,126 ms
コンパイル使用メモリ 195,260 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-20 01:30:26
合計ジャッジ時間 2,906 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
typedef long long ll;
using namespace std;

int main() {
    string S, T;
    cin >> S >> T;

    int ans = 0;
    if (T.size() == 1) {
        rep(i, S.size()) {
            if (S[i] == T[0])
                ans++;
        }
    } else {
        rep(i, S.size()) {
            if (strncmp(&S[i], &T[0], T.size()) == 0) {
                ans++;
                i += T.size() - 2;
            }
        }
    }

    if (T.size() == 1 && ans > 0)
        ans = -1;

    cout << ans << endl;

    return 0;
}
0