結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー kenkooookenkoooo
提出日時 2015-05-08 23:04:40
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 795 bytes
コンパイル時間 2,396 ms
コンパイル使用メモリ 79,116 KB
実行使用メモリ 54,644 KB
最終ジャッジ日時 2024-04-21 13:09:29
合計ジャッジ時間 10,485 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 126 ms
41,660 KB
testcase_05 AC 146 ms
41,576 KB
testcase_06 AC 152 ms
41,504 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 143 ms
41,724 KB
testcase_30 AC 142 ms
41,388 KB
testcase_31 AC 145 ms
41,520 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 137 ms
41,556 KB
testcase_35 AC 140 ms
41,856 KB
testcase_36 AC 149 ms
41,536 KB
testcase_37 AC 139 ms
41,260 KB
testcase_38 AC 156 ms
42,016 KB
testcase_39 WA -
testcase_40 AC 134 ms
41,504 KB
testcase_41 AC 139 ms
41,632 KB
testcase_42 WA -
testcase_43 AC 143 ms
41,476 KB
testcase_44 AC 143 ms
41,908 KB
testcase_45 AC 135 ms
41,728 KB
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int D = sc.nextInt();
		String string = sc.next() + sc.next();
		sc.close();
		string = string.replaceAll("o", "1").replaceAll("x", "0");

		int max = 0;
		for (int i = 0; i < (1 << 14); i++) {
			if ((i & Integer.parseInt(string, 2)) != Integer.parseInt(string, 2)) {
				continue;
			}
			if (Integer.bitCount(i) - Integer.bitCount(Integer.parseInt(string, 2)) > D) {
				continue;
			}

			char[] bits = ("0" + Integer.toBinaryString(i) + "0").toCharArray();
			int cnt = 0;
			for (int j = 0; j < bits.length; j++) {
				if (bits[j] == '1') {
					cnt++;
				} else {
					max = Math.max(max, cnt);
					cnt = 0;
				}
			}

		}
		System.out.println(max);
	}
}
0