結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー kenji_shioyakenji_shioya
提出日時 2016-06-23 00:45:46
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 835 bytes
コンパイル時間 4,292 ms
コンパイル使用メモリ 77,072 KB
実行使用メモリ 41,684 KB
最終ジャッジ日時 2024-04-21 15:14:35
合計ジャッジ時間 12,265 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 136 ms
41,548 KB
testcase_04 AC 134 ms
41,364 KB
testcase_05 AC 132 ms
41,616 KB
testcase_06 AC 133 ms
41,196 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 135 ms
41,416 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 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 134 ms
41,408 KB
testcase_30 AC 134 ms
41,152 KB
testcase_31 AC 132 ms
41,412 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 133 ms
41,472 KB
testcase_35 WA -
testcase_36 AC 135 ms
41,204 KB
testcase_37 AC 132 ms
41,568 KB
testcase_38 AC 134 ms
41,384 KB
testcase_39 WA -
testcase_40 AC 132 ms
41,220 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 132 ms
41,396 KB
testcase_44 AC 132 ms
41,212 KB
testcase_45 AC 134 ms
41,384 KB
testcase_46 AC 131 ms
41,516 KB
testcase_47 WA -
testcase_48 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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

    Scanner sc = new Scanner(System.in);

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