結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー t8m8⛄️t8m8⛄️
提出日時 2015-05-22 01:23:29
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,376 bytes
コンパイル時間 4,004 ms
コンパイル使用メモリ 80,104 KB
実行使用メモリ 41,608 KB
最終ジャッジ日時 2024-04-21 14:33:53
合計ジャッジ時間 11,735 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
40,164 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 117 ms
40,144 KB
testcase_05 AC 132 ms
41,272 KB
testcase_06 AC 130 ms
41,240 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 133 ms
41,352 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 131 ms
41,500 KB
testcase_17 AC 129 ms
41,176 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 117 ms
40,232 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 117 ms
40,096 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 131 ms
41,484 KB
testcase_30 AC 130 ms
41,296 KB
testcase_31 AC 150 ms
41,272 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 131 ms
41,124 KB
testcase_35 AC 117 ms
40,084 KB
testcase_36 AC 134 ms
41,472 KB
testcase_37 AC 132 ms
41,232 KB
testcase_38 AC 132 ms
41,308 KB
testcase_39 WA -
testcase_40 AC 131 ms
41,224 KB
testcase_41 AC 129 ms
41,152 KB
testcase_42 WA -
testcase_43 AC 129 ms
41,172 KB
testcase_44 AC 116 ms
40,256 KB
testcase_45 AC 117 ms
40,116 KB
testcase_46 AC 117 ms
40,248 KB
testcase_47 WA -
testcase_48 AC 119 ms
40,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;

public class No0204 {
    
    static final Scanner in = new Scanner(System.in);
    static final PrintWriter out = new PrintWriter(System.out,false);

    static void solve() {
        int d = in.nextInt();
        String s = in.next();
        String t = in.next();
        s += t;
        char[] cs = s.toCharArray();


        int res = 0;
        for (int i=0; i<14; i++) {
            char[] clone = cs.clone();

            for (int j=i; j-i<d && j<14; j++) {
                clone[j] = 'o';
            }

            res = max(res,count(clone));
        }

        out.println(res);
    }

    static int count(char[] cs) {
        int res = 0;
        for (int i=1; i<14; i++) {
            if (cs[i] == 'x') continue;
            int cnt = 1;
            while (i < 14 && cs[i] == cs[i-1]) {
                cnt++;
                i++;
            }
            res = max(res,cnt);
        }

        return res;
    }

    public static void main(String[] args) {
        long start = System.currentTimeMillis();

        solve();
        out.flush();

        long end = System.currentTimeMillis();
        //trace(end-start + "ms");
        in.close();
        out.close();
    }

    static void trace(Object... o) { System.out.println(deepToString(o));}
}
0