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