結果
| 問題 |
No.526 フィボナッチ数列の第N項をMで割った余りを求める
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-11-09 17:02:00 |
| 言語 | Kotlin (2.1.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 262 bytes |
| コンパイル時間 | 11,599 ms |
| コンパイル使用メモリ | 422,652 KB |
| 実行使用メモリ | 54,476 KB |
| 最終ジャッジ日時 | 2024-09-15 04:37:48 |
| 合計ジャッジ時間 | 16,612 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 3 |
| other | RE * 12 |
ソースコード
import java.math.BigInteger
fun main(){println(fib(readLine()!!.toBigInteger())%readLine()!!.toBigInteger())}
tailrec fun fib(n:BigInteger,a:BigInteger=BigInteger.ZERO,b:BigInteger=BigInteger.ONE):BigInteger{return if(n==BigInteger.ONE)a else fib(n.dec(),b,a+b)}