結果
問題 |
No.526 フィボナッチ数列の第N項をMで割った余りを求める
|
ユーザー |
![]() |
提出日時 | 2017-06-16 18:19:55 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 236 bytes |
コンパイル時間 | 326 ms |
コンパイル使用メモリ | 22,784 KB |
実行使用メモリ | 22,988 KB |
最終ジャッジ日時 | 2024-10-01 06:49:50 |
合計ジャッジ時間 | 1,030 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; int x=1073741825; for(i=2;i<n;i++){ dp[i]=(dp[i-2]+dp[i-1])%x; } printf("%d\n",dp[n-1]%m); }