結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー LeonardoneLeonardone
提出日時 2017-06-10 04:49:10
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,806 ms / 2,000 ms
コード長 163 bytes
コンパイル時間 120 ms
コンパイル使用メモリ 11,932 KB
実行使用メモリ 31,876 KB
最終ジャッジ日時 2023-10-24 05:56:09
合計ジャッジ時間 10,230 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
16,748 KB
testcase_01 AC 100 ms
16,748 KB
testcase_02 AC 98 ms
16,748 KB
testcase_03 AC 99 ms
16,748 KB
testcase_04 AC 99 ms
16,748 KB
testcase_05 AC 98 ms
16,748 KB
testcase_06 AC 95 ms
16,752 KB
testcase_07 AC 100 ms
16,748 KB
testcase_08 AC 103 ms
16,752 KB
testcase_09 AC 110 ms
16,748 KB
testcase_10 AC 272 ms
19,328 KB
testcase_11 AC 1,799 ms
31,876 KB
testcase_12 AC 1,806 ms
31,876 KB
testcase_13 AC 1,802 ms
31,876 KB
testcase_14 AC 1,802 ms
31,876 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# yukicoder My Practice
# author: Leonardone @ NEETSDKASU

require 'matrix'

n, m = gets.strip.split.map &:to_i

mat = Matrix[[1, 1], [1, 0]] ** n

p mat[1, 1] % m
0