結果
| 問題 | No.526 フィボナッチ数列の第N項をMで割った余りを求める | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-04-05 11:31:46 | 
| 言語 | Common Lisp (sbcl 2.5.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 171 ms / 2,000 ms | 
| コード長 | 389 bytes | 
| コンパイル時間 | 542 ms | 
| コンパイル使用メモリ | 33,228 KB | 
| 実行使用メモリ | 19,840 KB | 
| 最終ジャッジ日時 | 2025-04-05 11:31:49 | 
| 合計ジャッジ時間 | 2,504 ms | 
| ジャッジサーバーID (参考情報) | judge6 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 12 | 
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 05 APR 2025 11:31:46 AM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.015
ソースコード
(defvar N)
(defvar M)
(defvar temp)
(setq temp (read-from-string (concatenate 'string "(" (read-line) ")")))
(setq N (nth 0 temp))
(setq M (nth 1 temp))
;(format t "~d ~d~%" N M)
(defvar f1)
(defvar f2)
(setq f1 0)
(setq f2 1)
(setq temp 0)
(loop for i from 3 to N do
	(setq temp f2)
	(setq f2 (mod (+ f1 f2) M))
	(setq f1 temp))
(format t "~d~%" (case N (1 0) (2 1) (otherwise f2)))
 	
            
            
            
        