結果
問題 | No.1005 BOT対策 |
ユーザー |
![]() |
提出日時 | 2020-03-06 23:04:56 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 590 bytes |
コンパイル時間 | 3,119 ms |
コンパイル使用メモリ | 191,996 KB |
最終ジャッジ日時 | 2025-01-09 05:31:36 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#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;}