結果
| 問題 | 
                            No.64 XORフィボナッチ数列
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2016-02-10 04:53:34 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 704 bytes | 
| コンパイル時間 | 389 ms | 
| コンパイル使用メモリ | 54,288 KB | 
| 実行使用メモリ | 10,012 KB | 
| 最終ジャッジ日時 | 2024-09-21 22:04:33 | 
| 合計ジャッジ時間 | 6,895 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 6 TLE * 1 -- * 4 | 
ソースコード
#include <cstdint>
#include <cstdlib>
#include <iostream>
static std::uint64_t
xorFibonacci(std::uint64_t n, std::uint64_t f0, std::uint64_t f1);
int
main()
{
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  std::uint64_t f0, f1, n;
  std::cin >> f0 >> f1 >> n;
  std::cout << xorFibonacci(n, f0, f1) << std::endl;
  return EXIT_SUCCESS;
}
static std::uint64_t
xorFibonacci(std::uint64_t n, std::uint64_t f0, std::uint64_t f1)
{
  switch (n) {
    case 0:
      return f0;
    case 1:
      return f1;
    default:
      {
        for (std::uint64_t i = 1; i < n; i++) {
          std::uint64_t f = f1 ^ f0;
          f0 = f1;
          f1 = f;
        }
        return f1;
      }
  }
}