結果

問題 No.64 XORフィボナッチ数列
ユーザー lunnear
提出日時 2019-01-22 16:18:25
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 479 bytes
コンパイル時間 411 ms
コンパイル使用メモリ 54,008 KB
実行使用メモリ 8,576 KB
最終ジャッジ日時 2024-09-15 13:34:12
合計ジャッジ時間 7,005 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 TLE * 1 -- * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

int main()
{
    unsigned long long f0, f1, n;
    std::cin >> f0 >> f1 >> n;
    
    if(n == 0)
    {
        std::cout << f0 << std::endl;
        return 0;
    }
    if(n == 1)
    {
        std::cout << f1 << std::endl;
        return 0;
    }
    
    unsigned long long next;
    for(unsigned long long i = 2; i <= n; i++)
    {
        next = f0 ^ f1;
        f0 = f1;
        f1 = next;
    }
    
    std::cout << next << std::endl;
    return 0;
}
0