結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー GrenacheGrenache
提出日時 2015-05-08 23:34:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 162 ms / 1,000 ms
コード長 848 bytes
コンパイル時間 2,416 ms
コンパイル使用メモリ 75,380 KB
実行使用メモリ 57,168 KB
最終ジャッジ日時 2023-08-25 23:37:15
合計ジャッジ時間 11,963 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 154 ms
56,784 KB
testcase_01 AC 154 ms
56,812 KB
testcase_02 AC 155 ms
56,676 KB
testcase_03 AC 152 ms
56,920 KB
testcase_04 AC 152 ms
56,520 KB
testcase_05 AC 153 ms
56,684 KB
testcase_06 AC 152 ms
56,908 KB
testcase_07 AC 154 ms
56,824 KB
testcase_08 AC 155 ms
54,948 KB
testcase_09 AC 156 ms
56,972 KB
testcase_10 AC 153 ms
56,788 KB
testcase_11 AC 153 ms
56,604 KB
testcase_12 AC 153 ms
56,668 KB
testcase_13 AC 154 ms
57,132 KB
testcase_14 AC 151 ms
57,168 KB
testcase_15 AC 155 ms
54,992 KB
testcase_16 AC 156 ms
57,080 KB
testcase_17 AC 154 ms
56,536 KB
testcase_18 AC 156 ms
56,664 KB
testcase_19 AC 153 ms
56,480 KB
testcase_20 AC 156 ms
57,052 KB
testcase_21 AC 150 ms
56,992 KB
testcase_22 AC 151 ms
56,804 KB
testcase_23 AC 155 ms
56,964 KB
testcase_24 AC 154 ms
56,628 KB
testcase_25 AC 155 ms
56,676 KB
testcase_26 AC 153 ms
56,812 KB
testcase_27 AC 153 ms
56,716 KB
testcase_28 AC 153 ms
57,008 KB
testcase_29 AC 154 ms
56,688 KB
testcase_30 AC 154 ms
56,840 KB
testcase_31 AC 153 ms
56,616 KB
testcase_32 AC 152 ms
56,860 KB
testcase_33 AC 154 ms
56,948 KB
testcase_34 AC 153 ms
56,808 KB
testcase_35 AC 153 ms
56,580 KB
testcase_36 AC 153 ms
56,896 KB
testcase_37 AC 154 ms
56,624 KB
testcase_38 AC 156 ms
56,844 KB
testcase_39 AC 162 ms
56,812 KB
testcase_40 AC 159 ms
56,808 KB
testcase_41 AC 161 ms
55,064 KB
testcase_42 AC 161 ms
56,476 KB
testcase_43 AC 160 ms
56,872 KB
testcase_44 AC 159 ms
56,856 KB
testcase_45 AC 157 ms
56,540 KB
testcase_46 AC 159 ms
56,884 KB
testcase_47 AC 159 ms
56,972 KB
testcase_48 AC 156 ms
56,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder150508;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int d = sc.nextInt();
		String c = "xxxxxxx" + "xxxxxxx" + sc.next() + sc.next() + "xxxxxxx" + "xxxxxxx";
		StringBuffer[] cc = new StringBuffer[c.length()];

		for (int i = 0; i < c.length(); i++) {
			cc[i] = new StringBuffer(c);
			for (int j = i; j < i + d && j < cc[i].length(); j++) {
				if (cc[i].charAt(j) == 'x') {
					cc[i].setCharAt(j, 'o');
				} else {
					break;
				}
			}
		}
		
		int max = 0;
		for (int j = 0; j < cc.length; j++) {
			int count = 0;
			for (int i = 0; i < cc[j].length(); i++) {
				if (cc[j].charAt(i) == 'o') {
					count++;
					max = Math.max(max, count);
				} else {
					count = 0;
				}
			}
		}

		System.out.println(max);

		sc.close();
	}
}
0