結果
問題 | No.1005 BOT対策 |
ユーザー |
|
提出日時 | 2020-03-06 22:02:11 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 418 bytes |
コンパイル時間 | 1,375 ms |
コンパイル使用メモリ | 157,976 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-06-20 00:48:34 |
合計ジャッジ時間 | 2,356 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long signed main(){ string s, t; cin >> s >> t; int n = s.size(); int m = t.size(); int cnt = 0; if(m == 1 && s.find(t) != string::npos){ cout << -1 << endl; return 0; } for(int i = 0;i < s.size();i++){ if(i+m > s.size()) break; if(s.substr(i, m) == t){ s.insert(i+m-1, "."); cnt++; } } cout << cnt << endl; return 0; }