結果
| 問題 | No.1005 BOT対策 |
| コンテスト | |
| ユーザー |
Aquarius
|
| 提出日時 | 2020-03-15 18:04:39 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| + 241µs | |
| コード長 | 483 bytes |
| 記録 | |
| コンパイル時間 | 941 ms |
| コンパイル使用メモリ | 184,480 KB |
| 実行使用メモリ | 9,392 KB |
| 最終ジャッジ日時 | 2026-07-12 08:21:06 |
| 合計ジャッジ時間 | 2,539 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
string s, t;
int main() {
cin >> s >> t;
int len = t.size();
if (len == 1) {
cout << (s.find(t) == string::npos ? 0 : -1) << endl;
} else {
int cnt = 0;
int i = 0;
while (i < s.size()) {
if (s.substr(i, len) == t) {
++cnt;
i += len - 1;
} else {
++i;
}
}
cout << cnt << endl;
}
}
Aquarius