結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー t
提出日時 2017-06-16 18:11:39
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 213 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 22,784 KB
実行使用メモリ 22,452 KB
最終ジャッジ日時 2024-10-01 06:49:25
合計ジャッジ時間 933 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |     scanf("%d%d",&n,&m);
      |     ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
int dp[100000000];
int main(void){
    int n,m,i;
    scanf("%d%d",&n,&m);
    dp[0]=0;
    dp[1]=1;
    for(i=2;i<n;i++){
        dp[i]=(dp[i-2]+dp[i-1])%m;
    }
    printf("%d\n",dp[n-1]);
}
0