結果

問題 No.53 悪の漸化式
ユーザー MiyamonY
提出日時 2019-09-09 19:54:42
言語 Scheme
(Gauche-0.9.15)
結果
WA  
実行時間 -
コード長 313 bytes
コンパイル時間 59 ms
コンパイル使用メモリ 5,120 KB
実行使用メモリ 16,256 KB
最終ジャッジ日時 2024-06-28 14:07:26
合計ジャッジ時間 1,428 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

(define vec (make-vector 101 100))

(vector-set! vec 0 4)
(vector-set! vec 1 3)

(define (calc n)
  (define val (vector-ref vec n))
  (cond ((< val 10) val)
	(else
	 (let1 v (- (* (/. 19 4) (calc (- n 1) )) (* 3 (calc (- n 2))))
	       (vector-set! vec n v)
	       v))))

(let* ((n (read)))
  (print (calc n)))
0