結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 119 ms
40,176 KB
testcase_02 WA -
testcase_03 AC 134 ms
41,464 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 134 ms
41,348 KB
testcase_08 AC 120 ms
40,024 KB
testcase_09 AC 134 ms
41,140 KB
testcase_10 AC 132 ms
41,372 KB
testcase_11 AC 135 ms
41,308 KB
testcase_12 AC 119 ms
39,996 KB
testcase_13 AC 133 ms
41,128 KB
testcase_14 AC 140 ms
41,180 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 133 ms
41,300 KB
testcase_19 AC 120 ms
40,220 KB
testcase_20 AC 133 ms
40,924 KB
testcase_21 AC 136 ms
41,312 KB
testcase_22 AC 134 ms
41,120 KB
testcase_23 AC 132 ms
41,564 KB
testcase_24 AC 134 ms
41,336 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 132 ms
41,188 KB
testcase_30 AC 133 ms
41,372 KB
testcase_31 AC 133 ms
41,092 KB
testcase_32 AC 134 ms
41,280 KB
testcase_33 AC 134 ms
41,248 KB
testcase_34 WA -
testcase_35 RE -
testcase_36 RE -
testcase_37 AC 132 ms
41,280 KB
testcase_38 AC 119 ms
40,160 KB
testcase_39 AC 128 ms
41,136 KB
testcase_40 RE -
testcase_41 WA -
testcase_42 AC 133 ms
41,308 KB
testcase_43 RE -
testcase_44 RE -
testcase_45 AC 132 ms
40,980 KB
testcase_46 WA -
testcase_47 AC 133 ms
41,232 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;
		while(i+n-1<aa.length()){
			StringBuilder c = new StringBuilder(aa);
			c.replace(i, i+n-1,repString);
			ans=Math.max(ans, cul(c.toString()));
			i++;
		}
		System.out.println(ans);
	}
}
0