結果
問題 | No.1005 BOT対策 |
ユーザー | wonda_t_coffee |
提出日時 | 2020-03-06 22:14:50 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 1,187 bytes |
コンパイル時間 | 770 ms |
コンパイル使用メモリ | 83,924 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-01-01 20:07:37 |
合計ジャッジ時間 | 1,807 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <ctime> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define rep(i,n) for (int i = 0; i < (n); ++i) #define sort(a) sort((a).begin(), (a).end()); #define uniq(a) SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end()); #define reverse(a) reverse((a).begin(), (a).end()); #define out(d) cout << (d); #define outl(d) std::cout<<(d)<<"\n"; #define Yes() printf("Yes\n"); #define No() printf("No\n"); #define YES() printf("YES\n"); #define NO() printf("NO\n"); #define ceil(x, y) ((x + y - 1) / (y)) using namespace std; using ll = long long; using P = pair<ll,ll>; const ll MOD = 1000000007; // 10^9 + 7 int main() { cin.tie(0); ios::sync_with_stdio(false); srand((unsigned)time(NULL)); string s, t; cin >> s >> t; if (t.size() == 1 && s.find(t) != string::npos) { outl(-1); return 0; } int ans = 0; while (true) { auto pos = s.find(t); if (pos == string::npos) break; s.insert(pos + t.size() - 1, "."); ans++; } outl(ans) }