結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー kou6839kou6839
提出日時 2015-05-09 14:50:22
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,026 bytes
コンパイル時間 2,402 ms
コンパイル使用メモリ 79,628 KB
実行使用メモリ 41,528 KB
最終ジャッジ日時 2024-04-21 14:04:25
合計ジャッジ時間 10,092 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 132 ms
41,436 KB
testcase_02 AC 132 ms
41,256 KB
testcase_03 AC 132 ms
41,292 KB
testcase_04 AC 133 ms
41,260 KB
testcase_05 AC 132 ms
41,296 KB
testcase_06 AC 118 ms
40,004 KB
testcase_07 AC 131 ms
41,328 KB
testcase_08 AC 132 ms
41,124 KB
testcase_09 AC 119 ms
40,264 KB
testcase_10 AC 117 ms
40,264 KB
testcase_11 AC 134 ms
41,184 KB
testcase_12 AC 120 ms
39,984 KB
testcase_13 AC 133 ms
41,284 KB
testcase_14 AC 119 ms
40,220 KB
testcase_15 AC 131 ms
41,300 KB
testcase_16 AC 133 ms
41,216 KB
testcase_17 AC 119 ms
40,104 KB
testcase_18 AC 134 ms
41,344 KB
testcase_19 AC 134 ms
41,068 KB
testcase_20 AC 132 ms
41,252 KB
testcase_21 AC 118 ms
40,220 KB
testcase_22 AC 133 ms
41,208 KB
testcase_23 AC 134 ms
41,028 KB
testcase_24 AC 129 ms
41,376 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 132 ms
41,148 KB
testcase_29 AC 119 ms
40,168 KB
testcase_30 AC 132 ms
41,304 KB
testcase_31 AC 131 ms
41,020 KB
testcase_32 AC 131 ms
41,132 KB
testcase_33 AC 133 ms
41,088 KB
testcase_34 AC 132 ms
41,052 KB
testcase_35 AC 131 ms
41,124 KB
testcase_36 AC 133 ms
40,900 KB
testcase_37 AC 133 ms
41,256 KB
testcase_38 AC 135 ms
41,444 KB
testcase_39 AC 133 ms
41,340 KB
testcase_40 AC 119 ms
39,972 KB
testcase_41 WA -
testcase_42 AC 131 ms
41,280 KB
testcase_43 AC 138 ms
41,116 KB
testcase_44 AC 120 ms
40,120 KB
testcase_45 AC 131 ms
41,292 KB
testcase_46 AC 134 ms
41,116 KB
testcase_47 AC 118 ms
40,256 KB
testcase_48 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.File;
import java.util.*;

public class Main {
	static int cul(String a){
		int ans=0;
		for(int i=0;i<a.length();i++){
			if(a.charAt(i)=='o'){
				int temp=1;
				int j=1;
				while(i+j<a.length() && a.charAt(i+j)=='o'){
					j++;
					temp++;
				}
				ans=Math.max(ans, temp);
				i+=j;
			}
		}
		return ans;
	}
	public static void main(String[] args){
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String a = sc.next();
		String b = sc.next();
		a+=b;
		int ans=0;
		String aa ="xxxxxxxxxxxxxxxxxxxxxxxx";
		aa+=a;
		aa+="xxxxxxxxxxxxxxxxxxxx";
		String repString="";
		for(int i=0;i<n;i++) repString+="o";
		int i=0;
		tt:while(i+n-1<aa.length()){
			for(int j=i;j<i+n;j++){
				if(aa.charAt(j)=='o'){
					i++;
					continue tt;
				}
			}
			StringBuilder c = new StringBuilder(aa);
			c.replace(i, i+n,repString);
			//System.out.println(c);
			ans=Math.max(ans, cul(c.toString()));
			i++;
		}
		System.out.println(ans);
	}
}
0