結果

問題 No.45 回転寿司
ユーザー _Clay_____Clay____
提出日時 2018-09-17 13:38:31
言語 Scheme
(Gauche-0.9.14)
結果
WA  
実行時間 -
コード長 972 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 5,220 KB
実行使用メモリ 13,832 KB
最終ジャッジ日時 2023-09-25 09:20:48
合計ジャッジ時間 2,565 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
11,732 KB
testcase_01 WA -
testcase_02 AC 17 ms
12,000 KB
testcase_03 AC 17 ms
11,852 KB
testcase_04 AC 17 ms
11,744 KB
testcase_05 WA -
testcase_06 AC 18 ms
11,976 KB
testcase_07 AC 18 ms
11,916 KB
testcase_08 AC 17 ms
11,784 KB
testcase_09 WA -
testcase_10 AC 18 ms
13,816 KB
testcase_11 AC 17 ms
11,728 KB
testcase_12 WA -
testcase_13 AC 17 ms
11,796 KB
testcase_14 AC 16 ms
11,696 KB
testcase_15 WA -
testcase_16 AC 17 ms
11,792 KB
testcase_17 WA -
testcase_18 AC 18 ms
11,704 KB
testcase_19 AC 18 ms
11,992 KB
testcase_20 AC 18 ms
11,920 KB
testcase_21 AC 17 ms
11,704 KB
testcase_22 AC 17 ms
11,688 KB
testcase_23 AC 17 ms
11,756 KB
testcase_24 AC 17 ms
11,772 KB
testcase_25 AC 16 ms
11,904 KB
testcase_26 WA -
testcase_27 AC 18 ms
12,064 KB
testcase_28 AC 17 ms
11,760 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 16 ms
11,752 KB
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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