結果
| 問題 |
No.1005 BOT対策
|
| コンテスト | |
| ユーザー |
Aquarius
|
| 提出日時 | 2020-03-15 18:04:39 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 483 bytes |
| コンパイル時間 | 1,488 ms |
| コンパイル使用メモリ | 163,212 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-06-20 00:50:58 |
| 合計ジャッジ時間 | 2,373 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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