結果

問題 No.64 XORフィボナッチ数列
ユーザー masa
提出日時 2015-02-12 20:35:10
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 470 bytes
コンパイル時間 716 ms
コンパイル使用メモリ 60,544 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-23 19:17:07
合計ジャッジ時間 1,069 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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;
	long long 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