結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー motimoti
提出日時 2018-05-20 08:44:38
言語 Perl
(5.38.2)
結果
WA  
実行時間 -
コード長 214 bytes
コンパイル時間 42 ms
コンパイル使用メモリ 5,212 KB
実行使用メモリ 5,236 KB
最終ジャッジ日時 2023-09-10 23:54:05
合計ジャッジ時間 4,005 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
5,020 KB
testcase_01 AC 5 ms
4,828 KB
testcase_02 AC 5 ms
5,140 KB
testcase_03 AC 5 ms
4,852 KB
testcase_04 AC 4 ms
4,848 KB
testcase_05 AC 5 ms
4,972 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

#!/usr/bin/env perl

use strict;
use warnings;

my ($n, $m) = split / /,<>;
chomp $m;
my ($f1, $f2) = (0, 1);
my $f3;
for (my $i = 2; $i < $n; $i++) {
  $f3 = $f1 + $f2;
  $f1 = $f2;
  $f2 = $f3;
}
print $f3 % $m;
0