結果

問題 No.1005 BOT対策
ユーザー KKT89KKT89
提出日時 2020-03-06 21:32:38
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 559 bytes
コンパイル時間 887 ms
コンパイル使用メモリ 85,000 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-22 11:08:55
合計ジャッジ時間 1,747 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,816 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 WA -
testcase_12 AC 2 ms
6,940 KB
testcase_13 WA -
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 WA -
testcase_17 AC 2 ms
6,940 KB
testcase_18 AC 2 ms
6,944 KB
testcase_19 AC 2 ms
6,944 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 2 ms
6,944 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 AC 2 ms
6,940 KB
testcase_26 WA -
testcase_27 AC 2 ms
6,940 KB
testcase_28 AC 2 ms
6,940 KB
testcase_29 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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="";
	for(int i=0;i<s.size();i++){
		r+=s.substr(i,1);
		if(r==t){
			ans++;
			r=s.substr(i,1);
		}
		if(r[r.size()-1]!=t[r.size()-1]){
			r="";
		}
	}
	cout << ans << endl;
}
0