結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー ぴろず
提出日時 2015-05-08 23:23:22
言語 Java
(openjdk 23)
結果
AC  
実行時間 145 ms / 1,000 ms
コード長 705 bytes
コンパイル時間 2,189 ms
コンパイル使用メモリ 74,512 KB
実行使用メモリ 41,936 KB
最終ジャッジ日時 2024-12-24 11:38:57
合計ジャッジ時間 9,738 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 46
権限があれば一括ダウンロードができます

ソースコード

diff #

package no204a;

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int d = sc.nextInt();
		char[] c = new char[100];
		for(int i=0;i<2;i++) {
			char[] s = sc.next().toCharArray();
			for(int j=0;j<7;j++) {
				c[20+i*7+j] = s[j];
			}
		}
		int max = 0;
		for(int k=0;k<100;k++) {
			int now = 0;
			int yukyuu = 0;
			for(int i=0;i<100;i++) {
				if (i == k) {
					yukyuu = d;
				}
				if (c[i] == 'o') {
					now++;
					max = Math.max(max, now);
					yukyuu = 0;
				}else if(yukyuu > 0){
					now++;
					max = Math.max(max, now);
					yukyuu--;
				}else{
					now = 0;
				}
			}
		}
		System.out.println(max);
	}
}
0