結果

問題 No.2323 Nafmo、A+Bをする
ユーザー KitataiKitatai
提出日時 2023-05-28 14:31:25
言語 Common Lisp
(sbcl 2.5.0)
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 820 bytes
コンパイル時間 1,342 ms
コンパイル使用メモリ 27,648 KB
実行使用メモリ 21,760 KB
最終ジャッジ日時 2024-12-27 01:46:11
合計ジャッジ時間 2,822 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 27 DEC 2024 01:46:08 AM):

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

ソースコード

diff #

(defun bitto10 (bit)
    (cond ((equal bit '0) 0)
          ((equal bit '1) 1)
          (t (+ (mod bit 10) (* 2 (bitto10 (/ (- bit (mod bit 10)) 10)))))))

; 1,0からなるアトムのxor
(defun myxor (a b)
    (cond ((and (equal a '0) (equal b '0)) '0)
          ((and (equal a '0) (equal b '1)) '1)
          ((and (equal a '1) (equal b '0)) '1)
          ((and (equal a '1) (equal b '1)) '0)))

;複数桁のxor
(defun mylogxor (a b)
    (cond ((and (equal a 0) (equal b 0)) 0)
          ((and (equal a 0) (equal b 1)) 1)
          ((and (equal a 1) (equal b 0)) 1)
          ((and (equal a 1) (equal b 1)) 0)
          (t (+ (mod (myxor (mod a 10) (mod b 10)) 10) (* 10 (mylogxor (/ (- a (mod a 10)) 10) (/ (- b (mod b 10)) 10)))))))

(defun solve (a b) (bitto10 (mylogxor a b)))
(princ (solve (read) (read)))


0