結果
問題 |
No.1005 BOT対策
|
ユーザー |
|
提出日時 | 2020-06-17 02:44:58 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 772 bytes |
コンパイル時間 | 1,911 ms |
コンパイル使用メモリ | 194,432 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-06-20 00:53:10 |
合計ジャッジ時間 | 2,859 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long int; using lc = complex<double>; int main(void) { constexpr ll MOD = 1e9 + 7; constexpr double PI = acos(-1); cout << fixed << setprecision(32); cin.tie(0); ios::sync_with_stdio(false); string s,t; cin >> s >> t; ll n = s.size(), m = t.size(); if(m == 1) { for(auto &c: s) if(c == t[0]) { cout << -1 << endl; return 0; } cout << 0 << endl; return 0; } ll r = 0; for(ll i=0; i<n; i++) { ll j; for(j=0; j<m && i+j<n; j++) if(s[i+j] != t[j]) break; if(j == m) { i = i+m-1-1; r++; } } cout << r << endl; }