結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
コンテスト
ユーザー KisaragiEffective
提出日時 2019-11-09 17:02:00
言語 Kotlin
(2.3.20)
コンパイル:
kotlinc _filename_ -include-runtime -d main.jar
実行:
kotlin main.jar
結果
RE  
実行時間 -
コード長 262 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 7,837 ms
コンパイル使用メモリ 452,416 KB
実行使用メモリ 51,936 KB
最終ジャッジ日時 2026-04-04 17:17:49
合計ジャッジ時間 11,467 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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)}
0