結果

問題 No.64 XORフィボナッチ数列
ユーザー masa
提出日時 2015-02-12 20:34:16
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 464 bytes
コンパイル時間 485 ms
コンパイル使用メモリ 59,544 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-23 19:15:30
合計ジャッジ時間 1,174 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 1 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;
const int pattern[4][3] = {
	{0, 0, 0},
	{0, 1, 1},
	{1, 0, 1},
	{1, 1, 0}
};

int main() {
	long long f0, f1, n;

	cin >> f0 >> f1 >> n;

	n %= 3;
	int bit0, bit1;
	int ans = 0;

	for (int i = 0; i < 60; i++) {
		bit0 = (f0 >> i) & 1;
		bit1 = (f1 >> i) & 1;

		ans |= pattern[(bit0 << 1) | bit1][n] << i;
	}

	cout << ans << endl;
	return 0;
}
0