結果

問題 No.45 回転寿司
ユーザー chike_plus
提出日時 2019-03-28 12:50:48
言語 F#
(F# 4.0)
結果
AC  
実行時間 62 ms / 5,000 ms
コード長 405 bytes
コンパイル時間 19,053 ms
コンパイル使用メモリ 187,892 KB
実行使用メモリ 29,824 KB
最終ジャッジ日時 2024-12-27 20:22:17
合計ジャッジ時間 22,993 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (407 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

let ``No.45 回転寿司``() =
    
  let n = stdin.ReadLine() |> int
  let v = stdin.ReadLine().Split(' ')
          |> Array.map (fun s -> s |> int)
          |> Array.toList
  let rec loop r l =
    let prepre, pre = r
    match l with
    | []   -> 0
    | [x]  -> max (prepre + x) pre
    | x::xs-> loop (pre, max (prepre + x) pre) xs
  
  loop (0,0) v
  |> stdout.WriteLine

``No.45 回転寿司``()
0