結果
| 問題 | No.526 フィボナッチ数列の第N項をMで割った余りを求める |
| コンテスト | |
| ユーザー |
t
|
| 提出日時 | 2017-06-16 18:19:55 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 236 bytes |
| 記録 | |
| コンパイル時間 | 144 ms |
| コンパイル使用メモリ | 40,224 KB |
| 実行使用メモリ | 25,012 KB |
| 最終ジャッジ日時 | 2026-04-17 06:58:42 |
| 合計ジャッジ時間 | 1,084 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 4 WA * 8 |
ソースコード
#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);
}
t