結果
問題 | No.487 2017 Calculation(2017の計算) |
ユーザー |
![]() |
提出日時 | 2024-11-03 10:15:35 |
言語 | Common Lisp (sbcl 2.5.0) |
結果 |
AC
|
実行時間 | 10 ms / 2,000 ms |
コード長 | 425 bytes |
コンパイル時間 | 520 ms |
コンパイル使用メモリ | 37,408 KB |
実行使用メモリ | 30,140 KB |
最終ジャッジ日時 | 2024-11-03 10:15:36 |
合計ジャッジ時間 | 1,739 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 03 NOV 2024 10:15:35 AM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.006
ソースコード
(defun %mod-expt (a n m)(let ((result 1))(loop while (> n 0)when (oddp n)do (setq result (mod (* result a) m))do (setq a (mod (* a a) m))(setq n (ash n -1)))result))(defun main (&rest argv)(declare (ignorable argv))(let* ((m (read))(f (lambda (x) (mod (+ 2017 (%mod-expt (* 2017 2017) 2017 x)) x))))(format t "~d~%" (funcall f m))))(main)