結果
| 問題 |
No.1005 BOT対策
|
| コンテスト | |
| ユーザー |
CELICA
|
| 提出日時 | 2020-10-27 23:26:54 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 704 bytes |
| コンパイル時間 | 1,484 ms |
| コンパイル使用メモリ | 163,480 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-06-20 00:54:38 |
| 合計ジャッジ時間 | 2,464 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ul = unsigned long;
using ull = unsigned long long;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
string s, t;
cin >> s >> t;
size_t ss=s.size(),st=t.size();
int res{0};
if (ss < st)
res = 0;
else if (st == 1)
{
if (s.find(t) != string::npos)
res = -1;
}
else
{
size_t pos{0};
while(pos <= ss - st)
{
if (s.substr(pos, st) == t)
{
++res;
pos += st - 1;
}
else
++pos;
}
}
cout << res << "\n";
return 0;
}
CELICA