結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー kenji_shioyakenji_shioya
提出日時 2016-06-23 01:18:17
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 830 bytes
コンパイル時間 3,540 ms
コンパイル使用メモリ 77,260 KB
実行使用メモリ 55,184 KB
最終ジャッジ日時 2024-04-21 15:15:55
合計ジャッジ時間 11,756 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 144 ms
42,412 KB
testcase_01 WA -
testcase_02 AC 136 ms
42,528 KB
testcase_03 AC 154 ms
42,288 KB
testcase_04 AC 149 ms
42,284 KB
testcase_05 AC 155 ms
42,752 KB
testcase_06 AC 152 ms
42,564 KB
testcase_07 AC 148 ms
42,456 KB
testcase_08 AC 143 ms
42,404 KB
testcase_09 WA -
testcase_10 AC 150 ms
42,520 KB
testcase_11 AC 133 ms
42,568 KB
testcase_12 AC 146 ms
42,524 KB
testcase_13 WA -
testcase_14 AC 137 ms
42,632 KB
testcase_15 AC 136 ms
42,192 KB
testcase_16 AC 129 ms
42,396 KB
testcase_17 AC 137 ms
42,172 KB
testcase_18 WA -
testcase_19 AC 138 ms
42,436 KB
testcase_20 WA -
testcase_21 AC 129 ms
42,524 KB
testcase_22 AC 142 ms
42,540 KB
testcase_23 AC 129 ms
42,572 KB
testcase_24 AC 148 ms
42,560 KB
testcase_25 AC 152 ms
42,436 KB
testcase_26 AC 128 ms
42,436 KB
testcase_27 AC 136 ms
42,580 KB
testcase_28 AC 142 ms
41,856 KB
testcase_29 AC 140 ms
42,428 KB
testcase_30 AC 152 ms
42,744 KB
testcase_31 AC 149 ms
42,780 KB
testcase_32 AC 135 ms
42,688 KB
testcase_33 AC 148 ms
42,584 KB
testcase_34 AC 140 ms
42,696 KB
testcase_35 AC 142 ms
42,696 KB
testcase_36 AC 141 ms
42,684 KB
testcase_37 AC 141 ms
42,716 KB
testcase_38 AC 129 ms
42,512 KB
testcase_39 AC 137 ms
42,584 KB
testcase_40 AC 131 ms
42,572 KB
testcase_41 AC 143 ms
42,404 KB
testcase_42 AC 130 ms
42,436 KB
testcase_43 AC 130 ms
42,620 KB
testcase_44 AC 126 ms
42,268 KB
testcase_45 AC 137 ms
42,276 KB
testcase_46 AC 126 ms
42,496 KB
testcase_47 AC 137 ms
42,380 KB
testcase_48 AC 138 ms
42,416 KB
権限があれば一括ダウンロードができます

ソースコード

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++){
          if(wd[i + j] == 'o'){
            break;
          }
          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