結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー くれちーくれちー
提出日時 2017-04-04 17:59:09
言語 Perl
(5.38.2)
結果
AC  
実行時間 1,066 ms / 2,000 ms
コード長 153 bytes
コンパイル時間 331 ms
コンパイル使用メモリ 5,212 KB
実行使用メモリ 168,476 KB
最終ジャッジ日時 2023-09-22 17:14:13
合計ジャッジ時間 5,551 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,768 KB
testcase_01 AC 2 ms
4,580 KB
testcase_02 AC 3 ms
4,492 KB
testcase_03 AC 2 ms
4,624 KB
testcase_04 AC 2 ms
4,612 KB
testcase_05 AC 3 ms
4,556 KB
testcase_06 AC 2 ms
4,524 KB
testcase_07 AC 3 ms
4,664 KB
testcase_08 AC 4 ms
5,032 KB
testcase_09 AC 24 ms
7,576 KB
testcase_10 AC 219 ms
36,792 KB
testcase_11 AC 1,066 ms
168,476 KB
testcase_12 AC 1,060 ms
168,472 KB
testcase_13 AC 1,063 ms
168,368 KB
testcase_14 AC 1,059 ms
168,412 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

my ($n, $m) = split /\s/, <>;
my @fib = (0, 1);
for (my $i = 2; $i < $n; $i++) {
    push @fib, ($fib[$i - 1] + $fib[$i - 2]) % $m;
}
print $fib[$n - 1];
0