結果

問題 No.2323 Nafmo、A+Bをする
ユーザー KitataiKitatai
提出日時 2023-05-28 14:31:25
言語 Common Lisp
(sbcl 2.3.8)
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 820 bytes
コンパイル時間 711 ms
コンパイル使用メモリ 31,020 KB
実行使用メモリ 27,052 KB
最終ジャッジ日時 2023-08-27 10:01:00
合計ジャッジ時間 1,814 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
22,944 KB
testcase_01 AC 8 ms
22,992 KB
testcase_02 AC 9 ms
22,828 KB
testcase_03 AC 9 ms
22,968 KB
testcase_04 AC 9 ms
22,824 KB
testcase_05 AC 8 ms
23,004 KB
testcase_06 AC 9 ms
26,916 KB
testcase_07 AC 9 ms
22,968 KB
testcase_08 AC 10 ms
22,944 KB
testcase_09 AC 9 ms
26,984 KB
testcase_10 AC 9 ms
27,040 KB
testcase_11 AC 9 ms
22,940 KB
testcase_12 AC 11 ms
27,052 KB
testcase_13 AC 9 ms
22,932 KB
testcase_14 AC 8 ms
22,916 KB
testcase_15 AC 8 ms
22,968 KB
testcase_16 AC 8 ms
23,004 KB
testcase_17 AC 8 ms
22,928 KB
testcase_18 AC 8 ms
22,928 KB
testcase_19 AC 9 ms
24,936 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 27 AUG 2023 10:00:57 AM):
; processing (DEFUN BITTO10 ...)
; processing (DEFUN MYXOR ...)
; processing (DEFUN MYLOGXOR ...)
; processing (DEFUN SOLVE ...)
; processing (PRINC (SOLVE # ...))

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

ソースコード

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