結果
問題 | No.526 フィボナッチ数列の第N項をMで割った余りを求める |
ユーザー |
![]() |
提出日時 | 2017-06-12 13:03:12 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 84 ms / 2,000 ms |
コード長 | 304 bytes |
コンパイル時間 | 480 ms |
コンパイル使用メモリ | 54,444 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-24 16:43:24 |
合計ジャッジ時間 | 1,401 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 8 | main(){ | ^~~~
ソースコード
#include <iostream> using namespace std; unsigned long int f1,f2; main(){ unsigned long int N,M; unsigned long int F,a; //ݒ f1=0;f2=1; cin >> N >> M; for(int i=3;i<=N;i++){ a=(f2%M)+(f1%M); f1=f2; f2=a; } F=f2%M; cout << F << endl; return 0; }