結果

問題 No.2699 Simple Math (Returned)
ユーザー Lisp_CoderLisp_Coder
提出日時 2024-04-30 03:06:15
言語 Common Lisp
(sbcl 2.3.8)
結果
TLE  
実行時間 -
コード長 591 bytes
コンパイル時間 1,134 ms
コンパイル使用メモリ 35,116 KB
実行使用メモリ 37,884 KB
最終ジャッジ日時 2024-04-30 03:06:22
合計ジャッジ時間 7,284 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
27,648 KB
testcase_01 AC 536 ms
22,144 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 30 APR 2024 03:06:16 AM):

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

ソースコード

diff #

(defparameter modint 998244353)

(defun modpow (a n)
  (cond
   ((= n 0) 1)
   ((evenp n) (mod (expt (mod (* a a) modint) (/ n 2)) modint))
   (t (mod (* a (modpow a (- n 1))) modint))))

(defun solve (n m)
  (setf n (mod n (* 2 m)))
  (if (<= n m)
      (format t "~d~%" (mod (1- (modpow 10 n)) modint))
    (let* ((a (modpow 10 m))
           (b (modpow 10 (- n m)))
           (ans (mod (- a b) modint)))
      (format t "~d~%" ans))))

(defun main ()
  (let ((num-tests (read)))
    (dotimes (i num-tests)
      (let* ((n (read))
             (m (read)))
        (solve n m)))))

(main)
0