結果

問題 No.46 はじめのn歩
コンテスト
ユーザー elderica
提出日時 2023-11-10 23:15:07
言語 Common Lisp
(sbcl 2.6.3)
コンパイル:
sbclc _filename_
実行:
sbcl --script Main.fasl
結果
RE  
実行時間 -
コード長 1,190 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 204 ms
コンパイル使用メモリ 29,696 KB
実行使用メモリ 24,064 KB
最終ジャッジ日時 2026-04-13 04:50:44
合計ジャッジ時間 1,178 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other RE * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 13 APR 2026 04:50:42 AM):
; 
; caught ERROR:
;   READ error during COMPILE-FILE:
;   
;     Package UIOP does not exist.
;   
;       Line: 25, Column: 21, File-Position: 1084
;   
;       Stream: #<SB-INT:FORM-TRACKING-STREAM for "file /home/judge/data/code/Main.lisp" {1200C80003}>
; 
; compilation unit aborted
;   caught 1 fatal ERROR condition
;   caught 1 ERROR condition

; compilation aborted after 0:00:00.141

ソースコード

diff #
raw source code

(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
		 (uiop:split-string (read-line)))))

(multiple-value-bind
      (a b) (read-numbers)
  (format t "~a~%" (ceiling (/ b a))))
0