結果
問題 |
No.526 フィボナッチ数列の第N項をMで割った余りを求める
|
ユーザー |
|
提出日時 | 2018-04-21 07:54:03 |
言語 | Fortran (gFortran 14.2.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 451 bytes |
コンパイル時間 | 116 ms |
コンパイル使用メモリ | 30,976 KB |
実行使用メモリ | 87,356 KB |
最終ジャッジ日時 | 2024-06-27 05:22:27 |
合計ジャッジ時間 | 6,612 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 2 TLE * 2 -- * 8 |
ソースコード
module mdl integer*8::f(10000000) contains recursive function fib(n,m)result(res) integer*8::n,m,res if(f(n)/=-1)then res=f(n) else res=mod(fib(n-1,m)+fib(n-2,m),m) end if end function end module program main use mdl implicit none integer*8::i,j,k,n,m f(1)=0 f(2)=1 do i=3,size(f) f(i)=-1 end do read(*,*)n,m print*,fib(n,m) end program