結果

問題 No.290 1010
ユーザー legosuke
提出日時 2017-12-05 11:26:48
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 50 ms / 5,000 ms
コード長 379 bytes
コンパイル時間 1,252 ms
コンパイル使用メモリ 160,276 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-28 16:32:19
合計ジャッジ時間 2,522 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main(void) {
  int n;
  string s;
  cin >> n >> s;

  int sz = s.size();
  bool yes = false;
  for (int i = 0; i + 1 < sz; i++) {
    if (s[i + 1] == s[i]) {
      yes = true;
    } else if (i + 3 < sz && s.substr(i, 2) == s.substr(i + 2, 2)) {
      yes = true;
    }
  }
  cout << (yes ? "YES" : "NO") << endl;

  return 0;
}
0