結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー htensai
提出日時 2019-12-17 16:35:46
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 1,283 bytes
コンパイル時間 2,160 ms
コンパイル使用メモリ 77,888 KB
実行使用メモリ 52,120 KB
最終ジャッジ日時 2024-07-03 22:53:32
合計ジャッジ時間 6,195 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int d = Integer.parseInt(br.readLine());
        char[] arr = new char[14];
        for (int i = 0; i < 2; i++) {
            char[] line = br.readLine().toCharArray();
            for (int j = 0; j < 7; j++) {
                arr[i * 7 + j] = line[j];
            }
        }
        int max = 0;
        for (int i = 0; i < 14; i++) {
            boolean norm = false;
            boolean hor = false;
            int count = 0;
            int dCount = 0;
            for (int j = i; j < 14; j++) {
                if (arr[j] == 'o') {
                    if (norm) {
                        hor = true;
                    }
                } else {
                    if (hor) {
                        break;
                    } else {
                        norm = true;
                    }
                    dCount++;
                    if (dCount > d) {
                        break;
                    }
                }
                count++;
            }
            max = Math.max(max, count);
        }
        System.out.println(max);
    }
}
0