結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー kou6839kou6839
提出日時 2015-05-09 14:43:08
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 930 bytes
コンパイル時間 2,557 ms
コンパイル使用メモリ 84,140 KB
実行使用メモリ 41,656 KB
最終ジャッジ日時 2024-04-21 14:03:32
合計ジャッジ時間 11,533 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 155 ms
41,524 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 155 ms
41,600 KB
testcase_05 AC 153 ms
41,004 KB
testcase_06 AC 154 ms
41,504 KB
testcase_07 AC 153 ms
41,112 KB
testcase_08 AC 152 ms
41,260 KB
testcase_09 AC 150 ms
41,252 KB
testcase_10 AC 149 ms
41,280 KB
testcase_11 WA -
testcase_12 AC 151 ms
41,044 KB
testcase_13 AC 152 ms
41,340 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 149 ms
41,028 KB
testcase_17 AC 152 ms
41,404 KB
testcase_18 AC 150 ms
41,160 KB
testcase_19 AC 152 ms
41,056 KB
testcase_20 AC 151 ms
41,180 KB
testcase_21 AC 153 ms
41,656 KB
testcase_22 AC 152 ms
41,560 KB
testcase_23 AC 154 ms
41,188 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 151 ms
41,108 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 153 ms
41,244 KB
testcase_30 AC 155 ms
41,264 KB
testcase_31 AC 146 ms
41,164 KB
testcase_32 AC 151 ms
40,880 KB
testcase_33 AC 149 ms
41,008 KB
testcase_34 AC 158 ms
41,632 KB
testcase_35 AC 158 ms
41,144 KB
testcase_36 AC 154 ms
41,340 KB
testcase_37 AC 152 ms
41,108 KB
testcase_38 AC 155 ms
41,416 KB
testcase_39 AC 152 ms
41,132 KB
testcase_40 AC 151 ms
41,500 KB
testcase_41 AC 157 ms
41,308 KB
testcase_42 AC 157 ms
41,256 KB
testcase_43 AC 152 ms
41,300 KB
testcase_44 AC 150 ms
41,640 KB
testcase_45 AC 149 ms
41,308 KB
testcase_46 AC 149 ms
41,132 KB
testcase_47 WA -
testcase_48 AC 154 ms
41,280 KB
権限があれば一括ダウンロードができます

ソースコード

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,repString);
			//System.out.println(c);
			ans=Math.max(ans, cul(c.toString()));
			i++;
		}
		System.out.println(ans);
	}
}
0