結果
| 問題 | No.526 フィボナッチ数列の第N項をMで割った余りを求める |
| コンテスト | |
| ユーザー |
dnish
|
| 提出日時 | 2017-06-10 17:42:05 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 272 bytes |
| 記録 | |
| コンパイル時間 | 1,524 ms |
| コンパイル使用メモリ | 165,616 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-24 15:44:33 |
| 合計ジャッジ時間 | 2,085 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 4 WA * 8 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:3:22: warning: 'a3' may be used uninitialized [-Wmaybe-uninitialized]
3 | #define p(s) cout<<(s)<<endl
| ^
main.cpp:11:12: note: 'a3' was declared here
11 | ll a3;
| ^~
ソースコード
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=(n);i<(int)N;i++)
#define p(s) cout<<(s)<<endl
typedef long long ll;
using namespace std;
int main() {
ll n,m;
cin>>n>>m;
ll a1=0,a2=1;
ll a3;
REP(i,0,n-2){
a3=a2+a1;
a1=a2;
a2=a3;
}
p(a3%m);
return 0;
}
dnish