結果

問題 No.341 沈黙の期間
ユーザー r6ever6eve
提出日時 2017-08-16 19:57:47
言語 OCaml
(5.1.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 494 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 20,852 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 08:41:50
合計ジャッジ時間 849 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

let () =
  let s = read_line () in
  let n = String.length s in
  let horizontal_ellipsis_p i = i + 2 < n &&
    Char.code s.[i] = 0xe2 && Char.code s.[i+1] = 0x80 && Char.code s.[i+2] = 0xa6 in
  let rec aux i z =
    if not (horizontal_ellipsis_p i) then i, z
    else aux (i + 3) (z + 1) in
  let rec doit i x =
    if i = n then x
    else if not (horizontal_ellipsis_p i) then doit (i + 1) x
    else
      let i, z = aux i 0 in
      doit i (max x z) in
  doit 0 0 |> Printf.printf "%d\n"
0