結果
| 問題 |
No.1005 BOT対策
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-03-06 21:39:50 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 606 bytes |
| コンパイル時間 | 666 ms |
| コンパイル使用メモリ | 82,976 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-06-20 00:47:37 |
| 合計ジャッジ時間 | 1,647 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
using namespace std;
typedef long long int ll;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
string s,t; cin >> s >> t;
if(t.size()==1){
for(char c:s){
if(c==t[0]){
cout << -1 << endl;
return 0;
}
}
cout << 0 << endl;
return 0;
}
int ans=0;
string r="";
int j=0;
for(int i=0;i<s.size();i++){
r+=s.substr(i,1);
if(r==t){
ans++;
r=s.substr(i,1);
j=i;
continue;
}
if(r[r.size()-1]!=t[r.size()-1]){
r="";
i=j;
j++;
}
}
cout << ans << endl;
}