結果

問題 No.1005 BOT対策
ユーザー mmn15277198mmn15277198
提出日時 2020-03-25 23:11:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 824 bytes
コンパイル時間 583 ms
コンパイル使用メモリ 74,208 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-10 11:55:39
合計ジャッジ時間 1,360 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>

using namespace std;

int main(){
	string s,t;
	cin >> s >> t;
	
	int f=0;
	for(int i=0;i<s.size();i++){
		if(t[0]==s[i]){
			f++;
			for(int j=1;j<t.size();j++){
				i++;
				if(t[j]!=s[i]){
					f--;
					break;
				}
			}
		}
	}
	
	//ff=1:全部同じ
	int ff=0;
	if(f!=0){
		for(int i=0;i<t.size();i++){
			ff++;
			if(t[0]!=t[i]){
				ff=0;
				break;
			}
		}
	}
	
	if(f!=0 && ff!=0 && s.size()/t.size()==f && s.size()%t.size()!=0){
		if(t.size()>2){
			cout << (s.size()+t.size()-1)/t.size() << endl;
			return 0;
		}else{
			cout << s.size()-1 << endl;
			return 0;
		}
	}
	
	if(f!=0 && ff!=0 && s.size()/t.size()==f && s.size()%t.size()==0){
		cout << "-1" << endl;
		return 0;
	}
	
	cout << f << endl;
	return 0;
}

0