結果

問題 No.203 ゴールデン・ウィーク(1)
ユーザー ichibanshibori
提出日時 2016-10-14 00:50:24
言語 OCaml
(5.2.1)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 448 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 19,564 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-08 23:52:28
合計ジャッジ時間 960 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

let solve str =
  let lstr = String.length str in
  let rec solve' idx curSum maxSum =
    let nextMaxSum = if curSum > maxSum then curSum else maxSum in
    if idx >= lstr then nextMaxSum
    else
      let nextCurSum = if str.[idx] = 'o' then (curSum + 1) else 0 in
      solve' (idx + 1) nextCurSum nextMaxSum
  in
  solve' 0 0 0

let () =
  let s1 = read_line ()
  and s2 = read_line ()
  in
  solve (s1 ^ s2) |> string_of_int |> print_endline
0