結果
| 問題 |
No.428 小数から逃げる夢
|
| コンテスト | |
| ユーザー |
Common Lisp
|
| 提出日時 | 2024-11-08 20:52:14 |
| 言語 | Common Lisp (sbcl 2.5.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 1,000 ms |
| コード長 | 810 bytes |
| コンパイル時間 | 1,174 ms |
| コンパイル使用メモリ | 28,032 KB |
| 実行使用メモリ | 21,888 KB |
| 最終ジャッジ日時 | 2024-11-08 20:52:27 |
| 合計ジャッジ時間 | 4,843 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 100 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 08 NOV 2024 08:52:22 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.034
ソースコード
(defconstant +d+ "01234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991")
(defun main (&rest argv)
(declare (ignorable argv))
(let* ((n (read))
(a (make-array 191 :element-type 'integer :initial-element 0))
(b (make-array 192 :element-type 'integer :initial-element 0)))
(loop for i to 190 do
(setf (aref a i) (- (char-code (char +d+ i)) (char-code #\0))))
(loop for i from 190 downto 0 do
(setf (aref b i) (+ (* (aref a i) n) (floor (- (aref b (1+ i)) (mod (aref b (1+ i)) 10)) 10))))
(format t "~d." (aref b 0))
(loop for i from 1 to 190 do
(format t "~d" (mod (aref b i) 10)))
(terpri)))
(main)
Common Lisp