結果
問題 |
No.526 フィボナッチ数列の第N項をMで割った余りを求める
|
ユーザー |
![]() |
提出日時 | 2017-06-16 18:13:17 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 213 bytes |
コンパイル時間 | 102 ms |
コンパイル使用メモリ | 22,400 KB |
実行使用メモリ | 23,128 KB |
最終ジャッジ日時 | 2024-10-01 06:49:26 |
合計ジャッジ時間 | 838 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 6 WA * 6 |
コンパイルメッセージ
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); | ~~~~~^~~~~~~~~~~~~~
ソースコード
#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]%m+dp[i-1]%m; } printf("%d\n",dp[n-1]); }