結果

問題 No.64 XORフィボナッチ数列
ユーザー shiratamashiratama
提出日時 2016-08-14 07:24:49
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 327 bytes
コンパイル時間 432 ms
コンパイル使用メモリ 54,228 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 06:30:57
合計ジャッジ時間 1,057 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>

auto main() -> int {
	int F0, F1, N;
	std::cin >> F0 >> F1 >> N;

	int FN;
	switch (N) {
	case 0:
		FN = F0;
		break;
	case 1:
		FN = F1;
		break;
	default:
		int a=0, b=F0, c=F1;
		for (int i = 1; i < N; i++) {
			a = b;
			b = c;
			c = a ^ b;
		}
		FN = c;
		break;
	}

	std::cout << FN << std::endl;
}
0