結果

問題 No.290 1010
ユーザー itezpace
提出日時 2016-09-11 08:14:07
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 28 ms / 5,000 ms
コード長 621 bytes
コンパイル時間 629 ms
コンパイル使用メモリ 57,812 KB
実行使用メモリ 9,072 KB
最終ジャッジ日時 2024-11-17 00:17:54
合計ジャッジ時間 1,565 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int main(){
  int n;
  cin>>n;
  string s1,s2,a;
  cin>>s1;
  s2=s1;
  a="NO";
  if(n<2){
    //pass
  } else {
    for(int i=1; i<n; ++i){
      string s3=s1;
      string s4=s2;
      int f=0;
      for(int j=1; j<=i; ++j){
        s3.insert(s3.begin(),0);
        s4.push_back(0);
      }
      int x=0;
      for(int j=i; j<n; ++j){
        if(s3[j]==s4[j]){
          x+=1;
          if(x==i){
            a="YES";
            f=1;
            break;
          }
        } else {
          x=0;
        }
      }
      if(f==1) break;
    }
  }
  cout<<a<<endl;
  return 0;
}
0