結果
問題 |
No.1005 BOT対策
|
ユーザー |
![]() |
提出日時 | 2025-05-02 00:11:19 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 642 bytes |
コンパイル時間 | 2,882 ms |
コンパイル使用メモリ | 276,352 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-06-20 02:55:06 |
合計ジャッジ時間 | 3,771 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { string S, T; cin >> S >> T; int N = S.size(); int T_N = T.size(); cin >> S >> T; if (T.size() == 1) { for (int i = 0; i < N; i++) { if (S[i] == T[0]) { cout << "-1"; return 0; } } } int ans = 0; for (int i = 0; i < N - T_N + 1;) { if (S.substr(i, T_N) == T) { ans++; i += T_N - 1; } else { i++; } } cout << ans; } // 012345 // sumomo.mo.mo.momomomonouchi