結果

問題 No.341 沈黙の期間
ユーザー fkwnw3_1243fkwnw3_1243
提出日時 2017-05-05 09:29:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 54 ms / 5,000 ms
コード長 769 bytes
コンパイル時間 1,958 ms
コンパイル使用メモリ 72,596 KB
実行使用メモリ 50,804 KB
最終ジャッジ日時 2023-10-12 09:40:39
合計ジャッジ時間 3,586 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
50,472 KB
testcase_01 AC 54 ms
50,440 KB
testcase_02 AC 53 ms
50,504 KB
testcase_03 AC 53 ms
50,616 KB
testcase_04 AC 53 ms
50,552 KB
testcase_05 AC 53 ms
50,804 KB
testcase_06 AC 52 ms
50,552 KB
testcase_07 AC 52 ms
50,592 KB
testcase_08 AC 53 ms
50,468 KB
testcase_09 AC 53 ms
50,780 KB
testcase_10 AC 54 ms
50,556 KB
testcase_11 AC 53 ms
50,528 KB
testcase_12 AC 53 ms
50,528 KB
testcase_13 AC 52 ms
48,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import static java.lang.System.in;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String S = reader.readLine();
        int[] table = new int[S.length()];
        for (int i = 0; i < S.length(); i++) {
            if (S.charAt(i) == '…') {
                table[i] = 1;
            }
        }
        for (int i = 1; i < S.length(); i++) {
            if(table[i] != 0) {
                table[i] = table[i] + table[i - 1];
            }

        }
        System.out.println(Arrays.stream(table).max().getAsInt());
    }
}
0