結果
| 問題 |
No.1005 BOT対策
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-06-14 23:56:29 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 507 bytes |
| コンパイル時間 | 1,783 ms |
| コンパイル使用メモリ | 195,392 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2025-06-20 00:53:05 |
| 合計ジャッジ時間 | 2,856 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
string s, t;
cin >> s >> t;
if (s.find(t) == string::npos)
cout << 0 << endl;
else if (t.length() == 1)
cout << -1 << endl;
else {
int ret = 0;
for (int i = 0; i < s.length(); i++) {
if (s.substr(i, t.length()) == t) {
++ret;
i += t.length()-2;
}
}
cout << ret << endl;
}
return 0;
}