結果
| 問題 |
No.526 フィボナッチ数列の第N項をMで割った余りを求める
|
| ユーザー |
Nasatame
|
| 提出日時 | 2017-06-09 22:31:46 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 66 ms / 2,000 ms |
| コード長 | 435 bytes |
| コンパイル時間 | 445 ms |
| コンパイル使用メモリ | 57,764 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-22 15:16:30 |
| 合計ジャッジ時間 | 1,269 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 |
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
unsigned long long int n,m;
cin >> n >> m;
unsigned long long int a = 0,b = 1;
for(unsigned long long int i = 0; i < n-1; i++){
//cout << a << " " << b << endl;
a = a+b;
a%=m;
swap(a,b);
}
cout << a << endl;
}
Nasatame