結果

問題 No.203 ゴールデン・ウィーク(1)
ユーザー samplelpmassamplelpmas
提出日時 2016-11-26 14:06:55
言語 Java19
(openjdk 21)
結果
AC  
実行時間 126 ms / 1,000 ms
コード長 662 bytes
コンパイル時間 3,956 ms
コンパイル使用メモリ 74,248 KB
実行使用メモリ 56,176 KB
最終ジャッジ日時 2023-08-11 16:25:33
合計ジャッジ時間 7,148 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,968 KB
testcase_01 AC 125 ms
55,484 KB
testcase_02 AC 126 ms
55,712 KB
testcase_03 AC 126 ms
55,592 KB
testcase_04 AC 124 ms
55,592 KB
testcase_05 AC 124 ms
55,756 KB
testcase_06 AC 125 ms
55,484 KB
testcase_07 AC 125 ms
55,396 KB
testcase_08 AC 124 ms
55,552 KB
testcase_09 AC 124 ms
55,712 KB
testcase_10 AC 124 ms
55,756 KB
testcase_11 AC 124 ms
55,760 KB
testcase_12 AC 124 ms
55,848 KB
testcase_13 AC 124 ms
55,704 KB
testcase_14 AC 125 ms
55,272 KB
testcase_15 AC 124 ms
55,512 KB
testcase_16 AC 125 ms
55,708 KB
testcase_17 AC 124 ms
55,240 KB
testcase_18 AC 125 ms
55,916 KB
testcase_19 AC 126 ms
55,728 KB
testcase_20 AC 123 ms
55,360 KB
testcase_21 AC 125 ms
56,176 KB
testcase_22 AC 123 ms
55,432 KB
testcase_23 AC 124 ms
55,284 KB
testcase_24 AC 124 ms
55,472 KB
testcase_25 AC 122 ms
55,588 KB
testcase_26 AC 123 ms
56,100 KB
testcase_27 AC 124 ms
55,428 KB
testcase_28 AC 123 ms
55,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String twoWeeks = sc.next() + sc.next();

        int holidayCount = 0;
        int holidayMax = 0;

        for (int i = 0; i < twoWeeks.length(); i++) {

            if (twoWeeks.charAt(i) == 'o') {

                holidayCount++;

                if (holidayMax < holidayCount) {
                    holidayMax = holidayCount;
                }

            } else if (twoWeeks.charAt(i) == 'x') {

                holidayCount = 0;

            }

        }

        System.out.println(holidayMax);

    }

}
0