結果

問題 No.341 沈黙の期間
ユーザー takeya_okinotakeya_okino
提出日時 2017-06-21 19:50:27
言語 Java21
(openjdk 21)
結果
AC  
実行時間 123 ms / 5,000 ms
コード長 492 bytes
コンパイル時間 2,037 ms
コンパイル使用メモリ 74,540 KB
実行使用メモリ 54,936 KB
最終ジャッジ日時 2024-04-10 09:11:10
合計ジャッジ時間 4,203 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
54,040 KB
testcase_01 AC 118 ms
54,184 KB
testcase_02 AC 120 ms
54,016 KB
testcase_03 AC 114 ms
54,152 KB
testcase_04 AC 119 ms
54,100 KB
testcase_05 AC 119 ms
54,220 KB
testcase_06 AC 107 ms
52,964 KB
testcase_07 AC 105 ms
53,112 KB
testcase_08 AC 113 ms
53,980 KB
testcase_09 AC 121 ms
54,936 KB
testcase_10 AC 123 ms
54,000 KB
testcase_11 AC 119 ms
54,244 KB
testcase_12 AC 119 ms
54,124 KB
testcase_13 AC 115 ms
54,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int ans = 0;
    int[] table = new int[S.length()];
    for(int i = 0; i < S.length(); i++) {
      if(S.charAt(i) == '…') table[i] = 1;
      if((i > 0) && (table[i] != 0)) table[i] = table[i] + table[i - 1];
    }
    for(int i = 0; i < S.length(); i++) {
      ans = Math.max(ans, table[i]);
    }
    System.out.println(ans);
  }
}
0