結果

問題 No.290 1010
ユーザー tsunabittsunabit
提出日時 2020-03-25 14:34:24
言語 Java21
(openjdk 21)
結果
AC  
実行時間 282 ms / 5,000 ms
コード長 571 bytes
コンパイル時間 3,698 ms
コンパイル使用メモリ 72,224 KB
実行使用メモリ 59,384 KB
最終ジャッジ日時 2023-08-30 11:37:32
合計ジャッジ時間 8,692 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,820 KB
testcase_01 AC 125 ms
55,960 KB
testcase_02 AC 120 ms
53,764 KB
testcase_03 AC 121 ms
56,312 KB
testcase_04 AC 120 ms
55,796 KB
testcase_05 AC 122 ms
55,948 KB
testcase_06 AC 121 ms
55,876 KB
testcase_07 AC 124 ms
56,428 KB
testcase_08 AC 121 ms
55,636 KB
testcase_09 AC 120 ms
56,004 KB
testcase_10 AC 123 ms
55,800 KB
testcase_11 AC 121 ms
55,520 KB
testcase_12 AC 123 ms
55,916 KB
testcase_13 AC 121 ms
55,980 KB
testcase_14 AC 121 ms
56,052 KB
testcase_15 AC 119 ms
55,768 KB
testcase_16 AC 121 ms
55,952 KB
testcase_17 AC 120 ms
56,268 KB
testcase_18 AC 121 ms
55,952 KB
testcase_19 AC 121 ms
55,796 KB
testcase_20 AC 276 ms
59,160 KB
testcase_21 AC 277 ms
59,384 KB
testcase_22 AC 281 ms
59,152 KB
testcase_23 AC 282 ms
59,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;

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