結果
| 問題 |
No.1005 BOT対策
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-27 11:58:58 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 508 bytes |
| コンパイル時間 | 4,220 ms |
| コンパイル使用メモリ | 250,440 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-06-20 02:05:51 |
| 合計ジャッジ時間 | 4,516 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;
string S, T;
int main() {
cin >> S >> T;
if (S.find(T) == -1) {
cout << 0 << endl;
return 0;
} else if (T.size() == 1) {
cout << -1 << endl;
return 0;
}
int idx = 0, cnt = 0;
while (idx < S.size()) {
if (S.substr(idx, T.size()) == T) {
cnt++;
idx += T.size() - 1;
} else idx++;
}
cout << cnt << endl;
return 0;
}