結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー kuramukuramu
提出日時 2016-01-30 13:40:44
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,358 bytes
コンパイル時間 2,414 ms
コンパイル使用メモリ 77,708 KB
実行使用メモリ 52,420 KB
最終ジャッジ日時 2024-04-21 15:03:59
合計ジャッジ時間 7,556 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
37,396 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 66 ms
37,304 KB
testcase_04 AC 65 ms
36,984 KB
testcase_05 AC 64 ms
37,096 KB
testcase_06 AC 66 ms
37,164 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 67 ms
37,260 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 66 ms
37,240 KB
testcase_26 AC 68 ms
37,180 KB
testcase_27 AC 66 ms
37,012 KB
testcase_28 WA -
testcase_29 AC 64 ms
37,028 KB
testcase_30 AC 67 ms
36,548 KB
testcase_31 AC 66 ms
37,132 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 67 ms
37,116 KB
testcase_35 AC 71 ms
36,708 KB
testcase_36 AC 67 ms
36,824 KB
testcase_37 AC 66 ms
37,212 KB
testcase_38 AC 66 ms
36,980 KB
testcase_39 WA -
testcase_40 AC 66 ms
37,032 KB
testcase_41 AC 67 ms
37,172 KB
testcase_42 WA -
testcase_43 AC 67 ms
37,320 KB
testcase_44 AC 67 ms
36,820 KB
testcase_45 AC 67 ms
37,288 KB
testcase_46 AC 67 ms
37,076 KB
testcase_47 WA -
testcase_48 AC 65 ms
37,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
	      BufferedReader stdReader =new BufferedReader(new InputStreamReader(System.in));
	      boolean[] N = new boolean[14];
	      try {
	    	  int D = Integer.parseInt(stdReader.readLine());
	    	  String[] temp1 = stdReader.readLine().split("");
	    	  String[] temp2 = stdReader.readLine().split("");
	    	 
	    	  int ans = 0;
	    	  for(int i=0;i<7;i++)
	    		  if(temp1[i].equals("o")) N[i] = true;
	    	  for(int i=7;i<14;i++)
	    		  if(temp2[i-7].equals("o")) N[i] = true;
	    	  
	    	  for(int i=0;i<14;i++){
	    		  int count = 0;
	    		  for(int j=0;j<D && i+j <14 ;j++){
	    			  if(!N[i+j]){
	    				  count++;
	    				  N[i+j] = true;
	    			  }else{
	    				  break;
	    			  }
	    		  }	    		  
	    		  ans = Math.max(ans, calc(N));
	    		  for(int j=0;j<count;j++){
	    			  N[i+j] = false;
	    		  }
	    	  }
	    	  System.out.println(ans);
	      } catch (IOException e) {
			e.printStackTrace();
	      }
	}
	
	public static int calc(boolean[] N){
		int count = 0;
		int ans = 0;
		for(int i=0;i<N.length;i++){
			if(N[i]){
				count++;	
			}else{
				ans = Math.max(ans, count);
				count=0;
			}
		}	
		ans = Math.max(ans, count);
		return ans;
	}
}
0