結果

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

ソースコード

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 (calc (- n 1) )) (* 12 (calc (- n 2)))) 4)
	       (vector-set! vec n v)
	       v))))
	       

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