結果

問題 No.290 1010
ユーザー t8m8⛄️t8m8⛄️
提出日時 2016-01-25 17:33:03
言語 Java21
(openjdk 21)
結果
AC  
実行時間 306 ms / 5,000 ms
コード長 836 bytes
コンパイル時間 3,581 ms
コンパイル使用メモリ 80,036 KB
実行使用メモリ 60,504 KB
最終ジャッジ日時 2023-10-21 14:58:31
合計ジャッジ時間 9,303 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
56,244 KB
testcase_01 AC 127 ms
57,524 KB
testcase_02 AC 126 ms
57,232 KB
testcase_03 AC 125 ms
57,728 KB
testcase_04 AC 124 ms
57,544 KB
testcase_05 AC 124 ms
57,540 KB
testcase_06 AC 124 ms
57,480 KB
testcase_07 AC 120 ms
57,300 KB
testcase_08 AC 128 ms
57,616 KB
testcase_09 AC 125 ms
57,608 KB
testcase_10 AC 125 ms
57,244 KB
testcase_11 AC 124 ms
57,420 KB
testcase_12 AC 126 ms
57,580 KB
testcase_13 AC 124 ms
57,536 KB
testcase_14 AC 128 ms
57,608 KB
testcase_15 AC 121 ms
57,300 KB
testcase_16 AC 124 ms
57,516 KB
testcase_17 AC 123 ms
57,588 KB
testcase_18 AC 116 ms
56,236 KB
testcase_19 AC 132 ms
57,484 KB
testcase_20 AC 291 ms
60,504 KB
testcase_21 AC 299 ms
60,488 KB
testcase_22 AC 297 ms
60,388 KB
testcase_23 AC 306 ms
60,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class No0290 {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {
		int n = in.nextInt();
		String s = in.next();
		boolean f = false;
		for (int i=0; i<n; i++) {
			if (i + 1 < n && s.charAt(i) == s.charAt(i+1)) f = true;
			if (i + 3 < n && s.charAt(i) == s.charAt(i+2) && s.charAt(i+1) == s.charAt(i+3)) f = true;
		}
		out.println(f ? "YES" : "NO");
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}
0