結果
| 問題 | No.388 階段 (1) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-11-10 23:26:30 |
| 言語 | Common Lisp (sbcl 2.6.3) |
| 結果 |
AC
|
| 実行時間 | 7 ms / 2,000 ms |
| コード長 | 1,188 bytes |
| 記録 | |
| コンパイル時間 | 179 ms |
| コンパイル使用メモリ | 31,104 KB |
| 実行使用メモリ | 22,656 KB |
| 最終ジャッジ日時 | 2026-04-13 05:01:10 |
| 合計ジャッジ時間 | 1,191 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 13 APR 2026 05:01:05 AM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.007
ソースコード
(defun split-string (string &key max (separator '(#\Space #\Tab)))
"Split STRING into a list of components separated by
any of the characters in the sequence SEPARATOR.
If MAX is specified, then no more than max(1,MAX) components will be returned,
starting the separation from the end, e.g. when called with arguments
\"a.b.c.d.e\" :max 3 :separator \".\" it will return (\"a.b.c\" \"d\" \"e\")."
(block ()
(let ((list nil) (words 0) (end (length string)))
(when (zerop end) (return nil))
(flet ((separatorp (char) (find char separator))
(done () (return (cons (subseq string 0 end) list))))
(loop
:for start = (if (and max (>= words (1- max)))
(done)
(position-if #'separatorp string :end end :from-end t))
:do (when (null start) (done))
(push (subseq string (1+ start) end) list)
(incf words)
(setf end start))))))
(defun read-numbers ()
(apply #'values
(mapcar #'parse-integer
(split-string (read-line)))))
(multiple-value-bind
(s f) (read-numbers)
(format t "~a~%" (1+ (floor (/ s f)))))