結果
| 問題 | No.290 1010 | 
| コンテスト | |
| ユーザー |  184 | 
| 提出日時 | 2015-10-16 23:38:15 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 6 ms / 5,000 ms | 
| コード長 | 390 bytes | 
| コンパイル時間 | 224 ms | 
| コンパイル使用メモリ | 34,388 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-21 20:44:13 | 
| 合計ジャッジ時間 | 1,158 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 24 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:36: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         char s[1000001];int n;scanf("%d%s",&n,s);
      |                               ~~~~~^~~~~~~~~~~~~
            
            ソースコード
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
//namaega184
int main(){
	char s[1000001];int n;scanf("%d%s",&n,s); 
	bool ans=0;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			if(j+j-1-i>=n)break;
			ans=1;
			for(int k=0;i+k<j;k++){
				if(s[i+k]!=s[j+k]){ans=0;break;}
			} 
			if(ans)break;
		}
		if(ans)break;
	}
	puts(ans?"YES":"NO"); 
	return 0;
}
            
            
            
        