結果
問題 |
No.204 ゴールデン・ウィーク(2)
|
ユーザー |
![]() |
提出日時 | 2019-11-25 12:16:43 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 889 bytes |
コンパイル時間 | 2,110 ms |
コンパイル使用メモリ | 77,332 KB |
実行使用メモリ | 56,300 KB |
最終ジャッジ日時 | 2024-10-12 23:30:59 |
合計ジャッジ時間 | 10,116 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 WA * 26 |
ソースコード
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; while (idx < 14 && !holidays[idx] && idx - i + 1 <= d) { idx++; count++; } while (idx < 14 && holidays[idx]) { idx++; count++; } max = Math.max(max, count); } System.out.println(max); } }