結果

問題 No.642 Two Operations No.1
コンテスト
ユーザー Common Lisp
提出日時 2024-11-07 22:01:15
言語 Common Lisp
(sbcl 2.6.7)
コンパイル:
sbclc _filename_
実行:
sbcl --script Main.fasl
結果
AC  
実行時間 6 ms / 2,000 ms
+ 656µs
コード長 322 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 210 ms
コンパイル使用メモリ 31,228 KB
実行使用メモリ 27,644 KB
最終ジャッジ日時 2026-09-20 21:45:50
合計ジャッジ時間 1,897 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 20 SEP 2026 09:45:47 PM):

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

ソースコード

diff #
raw source code

(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