結果

問題 No.290 1010
ユーザー itezpaceitezpace
提出日時 2016-09-11 08:14:07
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 26 ms / 5,000 ms
コード長 621 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 57,052 KB
実行使用メモリ 9,080 KB
最終ジャッジ日時 2024-04-28 10:14:21
合計ジャッジ時間 1,211 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 21 ms
8,220 KB
testcase_21 AC 21 ms
8,344 KB
testcase_22 AC 26 ms
9,080 KB
testcase_23 AC 21 ms
8,216 KB
権限があれば一括ダウンロードができます

ソースコード

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