結果

問題 No.290 1010
ユーザー TatsuDXTatsuDX
提出日時 2016-10-16 22:10:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 321 ms / 5,000 ms
コード長 418 bytes
コンパイル時間 4,005 ms
コンパイル使用メモリ 74,800 KB
実行使用メモリ 45,784 KB
最終ジャッジ日時 2024-05-02 02:43:12
合計ジャッジ時間 8,902 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
41,660 KB
testcase_01 AC 137 ms
41,276 KB
testcase_02 AC 138 ms
41,164 KB
testcase_03 AC 134 ms
41,084 KB
testcase_04 AC 133 ms
41,244 KB
testcase_05 AC 139 ms
41,204 KB
testcase_06 AC 141 ms
40,928 KB
testcase_07 AC 142 ms
41,044 KB
testcase_08 AC 139 ms
41,520 KB
testcase_09 AC 146 ms
41,196 KB
testcase_10 AC 134 ms
41,408 KB
testcase_11 AC 137 ms
41,040 KB
testcase_12 AC 137 ms
41,392 KB
testcase_13 AC 144 ms
41,412 KB
testcase_14 AC 136 ms
41,532 KB
testcase_15 AC 143 ms
41,304 KB
testcase_16 AC 146 ms
41,532 KB
testcase_17 AC 138 ms
41,248 KB
testcase_18 AC 140 ms
41,448 KB
testcase_19 AC 141 ms
41,384 KB
testcase_20 AC 321 ms
45,480 KB
testcase_21 AC 307 ms
45,724 KB
testcase_22 AC 302 ms
45,756 KB
testcase_23 AC 310 ms
45,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Test {
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int n = sc.nextInt();
		String s = sc.next();
		for(int i = 0; i < n-1; i++){
			for(int j = i+1; j < n && 2*j-i <= n; j++){
				if(s.substring(i, j).equals(s.substring(j, 2*j-i))){
					System.out.println("YES");
					return;
				}
			}
		}
		System.out.println("NO");
	}
}
0