結果
| 問題 | No.2699 Simple Math (Returned) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-30 03:10:33 |
| 言語 | Common Lisp (sbcl 2.6.3) |
| 結果 |
AC
|
| 実行時間 | 493 ms / 2,000 ms |
| コード長 | 648 bytes |
| 記録 | |
| コンパイル時間 | 426 ms |
| コンパイル使用メモリ | 30,720 KB |
| 実行使用メモリ | 22,528 KB |
| 最終ジャッジ日時 | 2026-05-13 21:02:03 |
| 合計ジャッジ時間 | 6,827 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 11 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 13 MAY 2026 09:01:56 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.007
ソースコード
(defparameter modint 998244353)
(defun modpow (x n)
(let ((res 1))
(loop
(when (<= n 0) (return res))
(when (oddp n)
(setf res (mod (* res x) modint)))
(setf x (mod (* x x) modint))
(setf n (ash n -1)))))
(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)