結果

問題 No.290 1010
ユーザー zaichu
提出日時 2016-01-01 22:37:02
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 553 bytes
コンパイル時間 2,043 ms
コンパイル使用メモリ 159,472 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-19 09:28:12
合計ジャッジ時間 2,608 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
	long long  n;
	cin >> n;
	if(n >= 4){
		cout << "YES" << endl;
		return 0;
	}
	n++;
	string str,s = " ";
	cin >> str;
	s += str;
	long long i,j;
	for(i = 1; i < n; i++){
		string str1 = "", str2 = "";;
		for(j = i; j + (j + 1 - i) <= n; j++){
			str1 += s[j];
			str2 += s[j+1];
			//			cout << i << " " << j << endl;
			//			cout << "str1 = " << str1 << " str2 = " << str2 << endl;
			if(str1 == str2){
				cout << "YES" << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;
}
0