結果

問題 No.642 Two Operations No.1
ユーザー Common Lisp
提出日時 2024-11-07 22:01:15
言語 Common Lisp
(sbcl 2.5.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 322 bytes
コンパイル時間 783 ms
コンパイル使用メモリ 26,880 KB
実行使用メモリ 21,760 KB
最終ジャッジ日時 2024-11-07 22:01:55
合計ジャッジ時間 1,407 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 07 NOV 2024 10:01:53 PM):

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

ソースコード

diff #

(defun main (&rest argv)
  (declare (ignorable argv))
  (let* ((n (read)))
    (when (= n 1)
          (format t "0~%")
          (return-from main))
    (let* ((s (1- n))
           (b (write-to-string s :base 2))
           (c (count #\0 b :start 1))
           (l (length b)))
      (format t "~d~%" (+ l c)))))

(main)
0