結果
問題 | No.64 XORフィボナッチ数列 |
ユーザー | koturn |
提出日時 | 2016-02-10 04:53:34 |
言語 | C++11 (gcc 11.4.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 704 bytes |
コンパイル時間 | 406 ms |
コンパイル使用メモリ | 55,512 KB |
実行使用メモリ | 8,696 KB |
最終ジャッジ日時 | 2023-10-21 20:38:51 |
合計ジャッジ時間 | 7,063 ms |
ジャッジサーバーID (参考情報) |
judge10 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,348 KB |
testcase_01 | AC | 2 ms
4,348 KB |
testcase_02 | AC | 2 ms
4,348 KB |
testcase_03 | AC | 1 ms
4,348 KB |
testcase_04 | AC | 2 ms
4,348 KB |
testcase_05 | AC | 2 ms
4,348 KB |
testcase_06 | AC | 1 ms
4,348 KB |
testcase_07 | AC | 2 ms
4,348 KB |
testcase_08 | AC | 2 ms
4,348 KB |
testcase_09 | TLE | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
ソースコード
#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; } } }