結果

問題 No.290 1010
ユーザー hhgfhn1hhgfhn1
提出日時 2018-11-18 23:02:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 278 ms / 5,000 ms
コード長 467 bytes
コンパイル時間 2,101 ms
コンパイル使用メモリ 72,784 KB
実行使用メモリ 59,556 KB
最終ジャッジ日時 2023-08-26 02:01:27
合計ジャッジ時間 7,944 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,920 KB
testcase_01 AC 119 ms
55,980 KB
testcase_02 AC 119 ms
56,028 KB
testcase_03 AC 118 ms
55,972 KB
testcase_04 AC 119 ms
56,128 KB
testcase_05 AC 119 ms
55,736 KB
testcase_06 AC 120 ms
56,128 KB
testcase_07 AC 120 ms
55,656 KB
testcase_08 AC 120 ms
56,260 KB
testcase_09 AC 120 ms
55,500 KB
testcase_10 AC 119 ms
55,696 KB
testcase_11 AC 119 ms
55,944 KB
testcase_12 AC 123 ms
55,824 KB
testcase_13 AC 120 ms
56,076 KB
testcase_14 AC 121 ms
55,724 KB
testcase_15 AC 119 ms
55,964 KB
testcase_16 AC 118 ms
56,132 KB
testcase_17 AC 118 ms
56,192 KB
testcase_18 AC 120 ms
55,464 KB
testcase_19 AC 120 ms
56,120 KB
testcase_20 AC 277 ms
59,556 KB
testcase_21 AC 278 ms
59,104 KB
testcase_22 AC 274 ms
59,012 KB
testcase_23 AC 277 ms
59,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n=scanner.nextInt();
		String s=scanner.next();
		for(int i=1;i<=n;i++) {
			for(int j=i;j+(j+1-i)<=n;j++) {
				String a=s.substring(i-1,j);
				String b=s.substring(j,j+(j+1-i));
				if(a.equals(b)) {
					System.out.println("YES");
					return;
				}
			}
		}
		System.out.println("NO");
	}
}
0