結果

問題 No.45 回転寿司
ユーザー _Clay____
提出日時 2018-09-15 22:16:30
言語 Scheme
(Gauche-0.9.15)
結果
TLE  
実行時間 -
コード長 564 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 6,688 KB
実行使用メモリ 27,424 KB
最終ジャッジ日時 2024-07-18 07:16:14
合計ジャッジ時間 12,515 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 4
other TLE * 1 -- * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

(let* ((n (string->number (read-line)))
       (v (list->vector(map string->number (string-split (read-line) " ")))))
      (letrec ((calc-max 
                   (lambda (i)
                     (cond
                       ((eq? i 1) (vector-ref v 0))
                       ((eq? i 2) (max (vector-ref v 0) (vector-ref v 1)))
                       (else (max
                              (calc-max (- i 1)) 
                              (+ (vector-ref v (- i 1)) 
                                (calc-max (- i 2)))))))))
              (print (calc-max n))))
0