結果
| 問題 |
No.1005 BOT対策
|
| コンテスト | |
| ユーザー |
qLethon
|
| 提出日時 | 2020-03-06 23:04:56 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 590 bytes |
| コンパイル時間 | 1,817 ms |
| コンパイル使用メモリ | 193,988 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-06-20 00:49:34 |
| 合計ジャッジ時間 | 2,388 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
string S, T;
cin >> S >> T;
int j = 0;
int ans = 0;
int n = T.size();
if (n == 1){
if (S.find(T[0]) == string::npos){
puts("0");
} else {
puts("-1");
}
return 0;
}
for (const auto &s: S){
if (s == T[j]){
j++;
if (j == n){
ans++;
j = 0;
}
} else {
j = 0;
}
if (j == 0 and s == T[0])
j++;
}
cout << ans << endl;
}
qLethon