結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー tsunabittsunabit
提出日時 2020-03-15 18:36:25
言語 Java19
(openjdk 21)
結果
AC  
実行時間 164 ms / 1,000 ms
コード長 786 bytes
コンパイル時間 3,419 ms
コンパイル使用メモリ 75,836 KB
実行使用メモリ 57,148 KB
最終ジャッジ日時 2023-08-16 17:35:11
合計ジャッジ時間 13,245 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 157 ms
56,528 KB
testcase_01 AC 160 ms
56,724 KB
testcase_02 AC 160 ms
56,764 KB
testcase_03 AC 160 ms
56,928 KB
testcase_04 AC 154 ms
56,820 KB
testcase_05 AC 151 ms
56,984 KB
testcase_06 AC 151 ms
56,652 KB
testcase_07 AC 158 ms
56,784 KB
testcase_08 AC 158 ms
56,560 KB
testcase_09 AC 161 ms
56,864 KB
testcase_10 AC 159 ms
56,836 KB
testcase_11 AC 159 ms
56,792 KB
testcase_12 AC 157 ms
56,552 KB
testcase_13 AC 160 ms
56,720 KB
testcase_14 AC 157 ms
56,764 KB
testcase_15 AC 157 ms
54,892 KB
testcase_16 AC 154 ms
56,800 KB
testcase_17 AC 151 ms
56,788 KB
testcase_18 AC 155 ms
56,556 KB
testcase_19 AC 155 ms
56,936 KB
testcase_20 AC 154 ms
56,876 KB
testcase_21 AC 157 ms
56,816 KB
testcase_22 AC 156 ms
56,920 KB
testcase_23 AC 160 ms
57,148 KB
testcase_24 AC 162 ms
56,804 KB
testcase_25 AC 164 ms
56,556 KB
testcase_26 AC 153 ms
56,808 KB
testcase_27 AC 154 ms
56,768 KB
testcase_28 AC 156 ms
56,544 KB
testcase_29 AC 152 ms
56,772 KB
testcase_30 AC 156 ms
56,492 KB
testcase_31 AC 156 ms
56,876 KB
testcase_32 AC 155 ms
56,884 KB
testcase_33 AC 160 ms
56,736 KB
testcase_34 AC 155 ms
56,780 KB
testcase_35 AC 152 ms
56,844 KB
testcase_36 AC 160 ms
54,972 KB
testcase_37 AC 152 ms
56,588 KB
testcase_38 AC 154 ms
56,736 KB
testcase_39 AC 153 ms
56,868 KB
testcase_40 AC 154 ms
56,976 KB
testcase_41 AC 154 ms
56,856 KB
testcase_42 AC 156 ms
56,856 KB
testcase_43 AC 150 ms
56,856 KB
testcase_44 AC 149 ms
56,880 KB
testcase_45 AC 153 ms
56,736 KB
testcase_46 AC 155 ms
56,924 KB
testcase_47 AC 160 ms
56,928 KB
testcase_48 AC 152 ms
56,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;

public class No204 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int d = sc.nextInt();
		String c = "xxxxxxxxxxxxxx" + sc.next() + sc.next() + "xxxxxxxxxxxxxx";
		int ans = 0;
		int t = 0;
		for(int i = 0; i < c.length(); i++) {
			String cc = c.substring(0, i);
			int h = 0, j = i;
			while(h < d && j < c.length()) {
				if(c.charAt(j) == 'x') {
					cc += "o";
					h++;
					j++;
				}else {
					break;
				}
			}
			cc += c.substring(j, c.length());
			int tmp = 0;
			for(int k = 0; k < c.length(); k++) {
				if(cc.charAt(k) == 'o') {
					tmp++;
				}else {
					ans = Math.max(ans, tmp);
					tmp = 0;
				}
			}
			ans = Math.max(ans, tmp);
		}
		System.out.println(ans);
	}
}
0