結果

問題 No.46 はじめのn歩
ユーザー eldericaelderica
提出日時 2023-11-10 23:15:07
言語 Common Lisp
(sbcl 2.3.8)
結果
RE  
実行時間 -
コード長 1,190 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 35,108 KB
実行使用メモリ 32,288 KB
最終ジャッジ日時 2023-11-10 23:15:08
合計ジャッジ時間 916 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 10 NOV 2023 02:15:07 PM):
; 
; 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" {10010E6FF3}>
; 
; compilation unit aborted
;   caught 1 fatal ERROR condition
;   caught 1 ERROR condition

; compilation aborted after 0:00:00.085

ソースコード

diff #

(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