結果

問題 No.290 1010
ユーザー fiord
提出日時 2015-10-16 22:39:40
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 22 ms / 5,000 ms
コード長 324 bytes
コンパイル時間 966 ms
コンパイル使用メモリ 56,608 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-21 19:44:36
合計ジャッジ時間 1,996 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;
int main(){
	int n;	cin>>n;
	string s;	cin>>s;
	for(int i=1;i<n;i++){
		if(s[i]==s[i-1]){
			cout<<"YES"<<endl;
			return 0;
		}
		else if(i+2<n){
			if(s[i-1]==s[i+1]&&s[i]==s[i+2]){
				cout<<"YES"<<endl;
				return 0;
			}
		}
	}
	cout<<"NO"<<endl;
	return 0;
}
0