結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー kenji_shioyakenji_shioya
提出日時 2016-06-23 01:19:18
言語 Java19
(openjdk 21)
結果
AC  
実行時間 146 ms / 1,000 ms
コード長 837 bytes
コンパイル時間 5,701 ms
コンパイル使用メモリ 78,740 KB
実行使用メモリ 58,904 KB
最終ジャッジ日時 2023-08-25 23:50:37
合計ジャッジ時間 11,965 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
56,648 KB
testcase_01 AC 127 ms
56,908 KB
testcase_02 AC 140 ms
56,708 KB
testcase_03 AC 134 ms
57,264 KB
testcase_04 AC 135 ms
56,888 KB
testcase_05 AC 138 ms
57,092 KB
testcase_06 AC 137 ms
56,636 KB
testcase_07 AC 138 ms
57,168 KB
testcase_08 AC 141 ms
57,008 KB
testcase_09 AC 139 ms
58,904 KB
testcase_10 AC 142 ms
57,000 KB
testcase_11 AC 138 ms
56,844 KB
testcase_12 AC 135 ms
56,652 KB
testcase_13 AC 135 ms
57,000 KB
testcase_14 AC 134 ms
56,664 KB
testcase_15 AC 140 ms
55,240 KB
testcase_16 AC 138 ms
57,136 KB
testcase_17 AC 136 ms
56,960 KB
testcase_18 AC 137 ms
56,916 KB
testcase_19 AC 137 ms
56,928 KB
testcase_20 AC 140 ms
57,128 KB
testcase_21 AC 141 ms
56,852 KB
testcase_22 AC 134 ms
56,740 KB
testcase_23 AC 136 ms
57,020 KB
testcase_24 AC 138 ms
57,140 KB
testcase_25 AC 131 ms
56,852 KB
testcase_26 AC 133 ms
56,416 KB
testcase_27 AC 140 ms
56,932 KB
testcase_28 AC 126 ms
56,824 KB
testcase_29 AC 138 ms
56,940 KB
testcase_30 AC 144 ms
56,996 KB
testcase_31 AC 131 ms
57,080 KB
testcase_32 AC 141 ms
54,908 KB
testcase_33 AC 140 ms
57,096 KB
testcase_34 AC 134 ms
56,940 KB
testcase_35 AC 136 ms
56,944 KB
testcase_36 AC 141 ms
56,624 KB
testcase_37 AC 132 ms
56,912 KB
testcase_38 AC 137 ms
56,960 KB
testcase_39 AC 142 ms
57,032 KB
testcase_40 AC 136 ms
56,892 KB
testcase_41 AC 146 ms
56,772 KB
testcase_42 AC 133 ms
57,208 KB
testcase_43 AC 139 ms
54,880 KB
testcase_44 AC 135 ms
56,628 KB
testcase_45 AC 132 ms
57,004 KB
testcase_46 AC 144 ms
56,988 KB
testcase_47 AC 143 ms
56,908 KB
testcase_48 AC 134 ms
56,956 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 = plus + 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