結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー htensai
提出日時 2019-11-25 10:14:13
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 790 bytes
コンパイル時間 2,566 ms
コンパイル使用メモリ 77,196 KB
実行使用メモリ 41,564 KB
最終ジャッジ日時 2024-10-12 20:55:17
合計ジャッジ時間 9,826 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int d = sc.nextInt();
		char[][] arrs = new char[2][];
		arrs[0] = sc.next().toCharArray();
		arrs[1] = sc.next().toCharArray();
		boolean[] holidays = new boolean[14];
		for (int i = 0; i < 2; i++) {
		    for (int j = 0; j < 7; j++) {
		        holidays[i * 7 + j] = arrs[i][j] == 'o';
		    }
		}
		int max = 0;
		for (int i = 0; i + d - 1 < 14; i++) {
		    int count = 0;
		    int idx = i - 1;
		    while (idx >= 0 && holidays[idx]) {
		        idx--;
		        count++;
		    }
		    idx = i + d;
		    while (idx < 14 && holidays[idx]) {
		        idx++;
		        count++;
		    }
		    max = Math.max(max, d + count);
		}
		System.out.println(max);
	}
}
0