結果

問題 No.525 二度寝の季節
ユーザー Common Lisp
提出日時 2024-10-10 12:29:32
言語 Common Lisp
(sbcl 2.5.0)
結果
AC  
実行時間 9 ms / 1,000 ms
コード長 1,083 bytes
コンパイル時間 1,106 ms
コンパイル使用メモリ 36,244 KB
実行使用メモリ 21,888 KB
最終ジャッジ日時 2024-10-10 12:29:35
合計ジャッジ時間 2,547 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 10 OCT 2024 12:29:32 PM):

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

ソースコード

diff #

; 与えられた時間を分解し 00:00 からの経過分を計算する
; 起きた時間を +5 することで求めて hh:mm 形式に直して出力する
(defun main (&rest argv)
  ; declare: dynamic-extent ftype ignorable ignore inline notinline optimize special type
  ; 特定の場所で使用され、宣言をするが評価はされない
           ; 以下の束縛の値は参照されないかもしれない
  (declare (ignorable argv))
  (let* ((s (read-line))
            ; read-from-string string &optional eof-error-p eof-value &key start end preserve-whitespace => object, position
         (h (read-from-string s t nil :end 2))
         (m (read-from-string s t nil :start 3 :end 5))
         (wake-up-time (+ (* h 60) m 5)))
    ; multiple-value-bind (var*) values-form declaration* form* => result*
    ; 新しい変数束縛を values-form によって作成し
    ; それを使って form を実行する
    (multiple-value-bind (wake-up-h wake-up-m) (floor wake-up-time 60)
      (format t "~2,'0d:~2,'0d~%" (mod wake-up-h 24) wake-up-m))))
(main)
0