結果

問題 No.64 XORフィボナッチ数列
ユーザー lunnearlunnear
提出日時 2019-01-22 16:18:25
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 479 bytes
コンパイル時間 371 ms
コンパイル使用メモリ 51,048 KB
実行使用メモリ 8,704 KB
最終ジャッジ日時 2023-10-13 17:41:42
合計ジャッジ時間 7,234 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,368 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 1 ms
4,352 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
権限があれば一括ダウンロードができます

ソースコード

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