結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー spaciaspacia
提出日時 2016-01-19 00:05:20
言語 Java21
(openjdk 21)
結果
AC  
実行時間 93 ms / 1,000 ms
コード長 933 bytes
コンパイル時間 4,213 ms
コンパイル使用メモリ 75,352 KB
実行使用メモリ 53,100 KB
最終ジャッジ日時 2023-08-25 23:47:26
合計ジャッジ時間 8,236 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
52,632 KB
testcase_01 AC 87 ms
52,664 KB
testcase_02 AC 85 ms
52,716 KB
testcase_03 AC 92 ms
52,884 KB
testcase_04 AC 82 ms
52,420 KB
testcase_05 AC 83 ms
52,968 KB
testcase_06 AC 80 ms
52,296 KB
testcase_07 AC 81 ms
52,348 KB
testcase_08 AC 83 ms
52,332 KB
testcase_09 AC 86 ms
50,872 KB
testcase_10 AC 83 ms
52,872 KB
testcase_11 AC 83 ms
52,644 KB
testcase_12 AC 82 ms
52,756 KB
testcase_13 AC 84 ms
53,060 KB
testcase_14 AC 93 ms
52,640 KB
testcase_15 AC 84 ms
52,864 KB
testcase_16 AC 81 ms
52,604 KB
testcase_17 AC 80 ms
52,512 KB
testcase_18 AC 87 ms
52,308 KB
testcase_19 AC 83 ms
52,788 KB
testcase_20 AC 82 ms
52,752 KB
testcase_21 AC 83 ms
52,452 KB
testcase_22 AC 85 ms
52,432 KB
testcase_23 AC 80 ms
51,212 KB
testcase_24 AC 93 ms
52,420 KB
testcase_25 AC 82 ms
52,556 KB
testcase_26 AC 84 ms
52,608 KB
testcase_27 AC 82 ms
52,612 KB
testcase_28 AC 84 ms
52,656 KB
testcase_29 AC 90 ms
52,592 KB
testcase_30 AC 87 ms
52,732 KB
testcase_31 AC 81 ms
52,968 KB
testcase_32 AC 82 ms
52,536 KB
testcase_33 AC 84 ms
52,464 KB
testcase_34 AC 83 ms
52,420 KB
testcase_35 AC 83 ms
52,928 KB
testcase_36 AC 83 ms
52,784 KB
testcase_37 AC 83 ms
52,532 KB
testcase_38 AC 83 ms
53,068 KB
testcase_39 AC 84 ms
53,076 KB
testcase_40 AC 82 ms
50,872 KB
testcase_41 AC 88 ms
52,720 KB
testcase_42 AC 84 ms
53,100 KB
testcase_43 AC 82 ms
53,048 KB
testcase_44 AC 81 ms
52,608 KB
testcase_45 AC 81 ms
52,332 KB
testcase_46 AC 83 ms
52,840 KB
testcase_47 AC 82 ms
52,476 KB
testcase_48 AC 80 ms
52,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class Main {
	
	public static void out (Object o) {
		System.out.println(o);
	}
	
	public static int solve (String s , int n) {
		int ret = 0;
		int len = s.length();
		for (int i = 0; i < len; i++) {
			int cnt = 0 , j = i;
			char[] c = s.toCharArray();
			while (j < len && cnt < n && c[j] == 'x') {
				cnt++;
				c[j++] = 'o';
			}
			//out(Arrays.toString(c));
			j = 0;
			cnt = 0;
			while (j < len) {
				while (j < len && c[j] == 'o') {
					cnt++;
					j++;
				}
				j++;
				ret = Math.max(ret , cnt);
				cnt = 0;
			}
		}
		return ret;
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		String w1 = br.readLine();
		String w2 = br.readLine();
		String x = "xxxxxxxxxxxxxx";
		out(solve(x + w1 + w2 + x , n));
	}
	
}
0