結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー spaciaspacia
提出日時 2016-01-18 23:59:29
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 894 bytes
コンパイル時間 2,130 ms
コンパイル使用メモリ 78,980 KB
実行使用メモリ 52,188 KB
最終ジャッジ日時 2024-04-21 15:03:21
合計ジャッジ時間 6,220 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
37,524 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 50 ms
37,352 KB
testcase_04 AC 52 ms
37,304 KB
testcase_05 AC 76 ms
37,524 KB
testcase_06 AC 49 ms
37,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 49 ms
37,104 KB
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 AC 50 ms
37,232 KB
testcase_26 AC 51 ms
36,928 KB
testcase_27 AC 51 ms
37,096 KB
testcase_28 WA -
testcase_29 AC 50 ms
37,052 KB
testcase_30 AC 52 ms
37,372 KB
testcase_31 AC 51 ms
37,524 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 51 ms
36,908 KB
testcase_35 AC 50 ms
36,944 KB
testcase_36 AC 49 ms
37,156 KB
testcase_37 AC 49 ms
37,368 KB
testcase_38 AC 49 ms
37,164 KB
testcase_39 WA -
testcase_40 AC 48 ms
37,360 KB
testcase_41 AC 49 ms
36,920 KB
testcase_42 WA -
testcase_43 AC 51 ms
37,244 KB
testcase_44 AC 52 ms
37,236 KB
testcase_45 AC 49 ms
37,228 KB
testcase_46 AC 53 ms
37,084 KB
testcase_47 WA -
testcase_48 AC 59 ms
36,828 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();
		out(solve(w1 + w2 , n));
	}
	
}
0