結果
問題 |
No.8054 ほぼ直角二等辺三角形
|
ユーザー |
![]() |
提出日時 | 2024-11-04 23:39:02 |
言語 | Common Lisp (sbcl 2.5.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 950 bytes |
コンパイル時間 | 354 ms |
コンパイル使用メモリ | 39,836 KB |
実行使用メモリ | 30,140 KB |
最終ジャッジ日時 | 2024-11-04 23:39:05 |
合計ジャッジ時間 | 2,534 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 04 NOV 2024 11:39:02 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.009
ソースコード
(defconstant +keta+ (make-array 19 :initial-contents '(1 10 100 1000 10000 100000 1000000 10000000 100000000 1000000000 10000000000 100000000000 1000000000000 10000000000000 100000000000000 1000000000000000 10000000000000000 100000000000000000 1000000000000000000))) (defun gen-pell-solver () (let ((x 7) (y 5)) (labels ((next () (let ((result (cons x y)) (xx x) (yy y)) (setq x (+ (* 3 xx) (* 4 yy)) y (+ (* 2 xx) (* 3 yy))) result))) (lambda () (next))))) (defun main (&rest argv) (declare (ignorable argv)) (let* ((x (1- (read))) (gen (gen-pell-solver))) (dotimes (_ 23) (let ((a+b.c (funcall gen))) (when (>= (cdr a+b.c) (aref +keta+ x)) (format t "~d ~d ~d~%" (floor (car a+b.c) 2) (ceiling (car a+b.c) 2) (cdr a+b.c)) (return-from main)))))) (main)