結果
問題 | No.143 豆 |
ユーザー | mikan-water |
提出日時 | 2024-01-14 10:40:58 |
言語 | Common Lisp (sbcl 2.3.8) |
結果 |
AC
|
実行時間 | 11 ms / 1,000 ms |
コード長 | 1,306 bytes |
コンパイル時間 | 83 ms |
コンパイル使用メモリ | 28,800 KB |
実行使用メモリ | 21,888 KB |
最終ジャッジ日時 | 2024-09-28 01:57:59 |
合計ジャッジ時間 | 931 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 9 ms
21,760 KB |
testcase_01 | AC | 9 ms
21,760 KB |
testcase_02 | AC | 9 ms
21,760 KB |
testcase_03 | AC | 9 ms
21,760 KB |
testcase_04 | AC | 9 ms
21,632 KB |
testcase_05 | AC | 10 ms
21,888 KB |
testcase_06 | AC | 8 ms
21,760 KB |
testcase_07 | AC | 10 ms
21,760 KB |
testcase_08 | AC | 10 ms
21,760 KB |
testcase_09 | AC | 9 ms
21,760 KB |
testcase_10 | AC | 9 ms
21,760 KB |
testcase_11 | AC | 9 ms
21,888 KB |
testcase_12 | AC | 9 ms
21,760 KB |
testcase_13 | AC | 9 ms
21,888 KB |
testcase_14 | AC | 11 ms
21,760 KB |
testcase_15 | AC | 10 ms
21,760 KB |
testcase_16 | AC | 9 ms
21,760 KB |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 28 SEP 2024 01:57:58 AM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.011
ソースコード
; variables ; k: the number of beans in a pack ; n: the number of packs ; f: the number of family members ; (k n f) (defparameter *bean-pack-family* ()) (defparameter *input-str* nil) (defparameter *num-list* ()) (defparameter *age-list* ()) (defvar *num-stack* ()) (defvar *list-stack* ()) ; function (defun separate-n (c) (cond ((char= c #\ ) (push (parse-integer (coerce (reverse *num-stack*) 'string)) *list-stack*) (setf *num-stack* '()) ) (t (push c *num-stack*))) ) (defun str-to-int-list (str) (map nil #'separate-n str) (push (parse-integer (coerce (reverse *num-stack*) 'string)) *list-stack*) (reverse *list-stack*) ) (defun input-to-list () (setf *input-str* (read-line)) (setf *num-list* (str-to-int-list *input-str*)) (reset-stack) ) (defun reset-stack () (setf *num-stack* ()) (setf *list-stack* ()) ) (defun input-to-age () (setf *input-str* (read-line)) (setf *age-list* (str-to-int-list *input-str*)) ) (defun eat-bean (total age-list) (cond ((< total 0) -1) ((< (length age-list) 1) total) (t (eat-bean (- total (car age-list)) (cdr age-list)))) ) (defun n143 () (input-to-list) (input-to-age) (princ (eat-bean (* (car *num-list*) (cadr *num-list*)) *age-list*)) ) (n143)