結果
| 問題 | No.526 フィボナッチ数列の第N項をMで割った余りを求める | 
| コンテスト | |
| ユーザー |  AREIDO2 | 
| 提出日時 | 2017-06-22 15:17:51 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 198 bytes | 
| コンパイル時間 | 429 ms | 
| コンパイル使用メモリ | 53,804 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-10-02 12:17:19 | 
| 合計ジャッジ時間 | 1,013 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 3 WA * 9 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:19: warning: ‘f3’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   12 |   cout << f3%m << "\n";
      |                   ^~~~
            
            ソースコード
#include<iostream>
using namespace std;
int main(){
  int n,m,f1=0,f2=1,f3;
  cin >> n >> m;
  for(int i=3;i<n+1;i++){
    f3=f1+f2;
    f1=f2;
    f2=f3;
  }
  cout << f3%m << "\n";
  return 0;
}
            
            
            
        