結果

問題 No.143 豆
ユーザー まんしmaNNshi
提出日時 2025-03-20 23:31:29
言語 Common Lisp
(sbcl 2.5.0)
結果
AC  
実行時間 12 ms / 1,000 ms
コード長 534 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 34,868 KB
実行使用メモリ 27,672 KB
最終ジャッジ日時 2025-03-20 23:31:32
合計ジャッジ時間 1,634 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 20 MAR 2025 11:31:29 PM):

; wrote /home/judge/data/code/Main.fasl
; compilation finished in 0:00:00.010

ソースコード

diff #

(defvar K)
(defvar N)
(defvar F)
(defvar A)
(defvar temp)
(setq temp (read-line))
(setq temp (concatenate 'string "(" temp ")" ))
(setq temp (read-from-string temp))
(setq K (nth 0 temp))
(setq N (nth 1 temp))
(setq F (nth 2 temp))

(setq temp (read-line))
(setq temp (concatenate 'string "(" temp ")" ))
(setq temp (read-from-string temp))
(setq A temp)

(defvar sum)
(setq sum 0)
(loop for x in A do (setq sum (+ sum x)))
;(format 't "<~d ~d ~d ~%>" K N F)
(if (<= sum (* K N)) (format 't "~d~%" (- (* K N) sum)) (format 't "-1~%"))
0