結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー kenji_shioya
提出日時 2016-06-23 01:07:09
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 767 bytes
コンパイル時間 3,623 ms
コンパイル使用メモリ 79,084 KB
実行使用メモリ 42,704 KB
最終ジャッジ日時 2024-10-13 14:03:25
合計ジャッジ時間 13,002 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Exercise112{
  public static void main (String[] args){

    Scanner sc = new Scanner(System.in);

    int d = sc.nextInt();
    String plus = "xxxxxxxxxxxxxx";
    String weeks = sc.next() + sc.next() + plus;
    char[] wa = weeks.toCharArray();
    int max = 0;
    for(int i = 0; i < wa.length; i++){
      if(wa[i] == 'x'){
        char[] wd = Arrays.copyOf(wa, wa.length);
        for(int j = 0; j < d && i + j < wd.length; j++){
          wd[i + j] = 'o';
        }
        int oCount = 0;
        for(char charInWd: wd){
          if(charInWd == 'o'){
            oCount++;
            max = Math.max(max, oCount);
          }else{
            oCount = 0;
          }
        }
      }
    }
    System.out.println(max);
  }
}
0