結果

問題 No.45 回転寿司
ユーザー chike_plus
提出日時 2019-03-28 12:50:48
言語 F#
(F# 10.0)
コンパイル:
fsharp_c _filename_
実行:
/usr/bin/dotnet_wrap
結果
AC  
実行時間 58 ms / 5,000 ms
コード長 405 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 14,345 ms
コンパイル使用メモリ 215,484 KB
実行使用メモリ 32,256 KB
最終ジャッジ日時 2026-06-02 06:52:57
合計ジャッジ時間 11,313 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (248 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net10.0/main.dll
  main -> /home/judge/data/code/bin/Release/net10.0/publish/

ソースコード

diff #
raw source code

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