結果

問題 No.143 豆
コンテスト
ユーザー まんしmaNNshi
提出日時 2025-03-20 23:31:29
言語 Common Lisp
(sbcl 2.6.3)
コンパイル:
sbclc _filename_
実行:
sbcl --script Main.fasl
結果
AC  
実行時間 7 ms / 1,000 ms
コード長 534 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 18 ms
コンパイル使用メモリ 35,708 KB
実行使用メモリ 27,640 KB
最終ジャッジ日時 2026-07-07 13:40:03
合計ジャッジ時間 1,235 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 07 JUL 2026 01:40:01 PM):

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

ソースコード

diff #
raw source code

(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