結果

問題 No.64 XORフィボナッチ数列
ユーザー f843nmfwisfeuwf843nmfwisfeuw
提出日時 2020-09-01 21:06:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 692 bytes
コンパイル時間 708 ms
コンパイル使用メモリ 91,872 KB
実行使用メモリ 10,140 KB
最終ジャッジ日時 2024-04-30 19:23:31
合計ジャッジ時間 7,363 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <string>
#include <map>
#include <iterator>
#include <set>
#include <queue>
#include <bitset>
#include <cassert>

using namespace std;

int main() {

    unsigned long long F0, F1, N;
    cin >> F0 >> F1 >> N;


    if (N == 0) {
        cout << F0 << endl;
    } else if (N == 1) {
        cout << F1 << endl;
    } else {
        unsigned long long Fi;
        for (int i = 1; i < N; ++i) {
            Fi = F1 ^ F0;
            unsigned long long tmp = F1;
            F1 = Fi;
            F0 = tmp;
        }
        cout << Fi << endl;
    }


}
0