結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー DemocoDemoco
提出日時 2015-05-17 18:25:36
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 982 bytes
コンパイル時間 2,199 ms
コンパイル使用メモリ 79,244 KB
実行使用メモリ 42,184 KB
最終ジャッジ日時 2024-04-21 14:07:01
合計ジャッジ時間 10,410 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 131 ms
40,524 KB
testcase_02 AC 144 ms
41,684 KB
testcase_03 AC 133 ms
40,420 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 146 ms
41,640 KB
testcase_08 WA -
testcase_09 AC 147 ms
41,660 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 144 ms
41,536 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 135 ms
40,240 KB
testcase_19 WA -
testcase_20 AC 130 ms
40,496 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 145 ms
41,540 KB
testcase_29 AC 140 ms
41,328 KB
testcase_30 AC 132 ms
40,404 KB
testcase_31 AC 135 ms
41,072 KB
testcase_32 AC 132 ms
40,300 KB
testcase_33 AC 144 ms
41,436 KB
testcase_34 WA -
testcase_35 AC 142 ms
41,748 KB
testcase_36 AC 145 ms
41,380 KB
testcase_37 AC 142 ms
41,716 KB
testcase_38 AC 130 ms
40,512 KB
testcase_39 AC 131 ms
40,384 KB
testcase_40 AC 135 ms
40,952 KB
testcase_41 WA -
testcase_42 AC 143 ms
41,500 KB
testcase_43 AC 145 ms
41,456 KB
testcase_44 AC 146 ms
41,428 KB
testcase_45 AC 131 ms
40,400 KB
testcase_46 AC 143 ms
41,424 KB
testcase_47 WA -
testcase_48 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
class Yukico204 {
	public static void main(String[] args) {
		Scanner stdio = new Scanner(System.in);
		int d = stdio.nextInt();
		String s = stdio.next();
		s += stdio.next();
		s = "xxxxxxxxxxxxxx"+s+"xxxxxxxxxxxxxx";
		int ans = d;
		int cnt=0;
		for(int i=0; i<s.length(); i++) {
			if(s.charAt(i) == 'o') {
				cnt++;
				ans = Math.max(ans, cnt);
			} else {
				cnt = 0;
			}
		}
		if(d==0) {
			System.out.println(ans);
		} else {
			cnt = 0;
			for(int i=0; i<s.length(); i++) {
				cnt = 0;
				boolean b=true;
				for(int j=i; j<s.length(); j++) { 
					if((j-i)>=0 && (j-i)<d && b) {
						if(s.charAt(j) == 'o') {
							cnt++;
							ans = Math.max(ans, cnt);
							b = false;
						} else {
							cnt++;
							ans = Math.max(ans, cnt);
						}
					} else if(s.charAt(j) == 'o') {
						cnt++;
						ans = Math.max(ans, cnt);
					}
					else {
						cnt = 0;
					}
				}
				ans = Math.max(ans, cnt);
			}
			System.out.println(ans);
		}
	}
}
0