結果

問題 No.64 XORフィボナッチ数列
ユーザー Shawn stayCShawn stayC
提出日時 2020-06-29 23:04:45
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2,330 ms / 5,000 ms
コード長 273 bytes
コンパイル時間 1,450 ms
コンパイル使用メモリ 165,588 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-19 06:05:19
合計ジャッジ時間 7,505 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
	ll f0,f1,n; cin>>f0>>f1>>n;
	ll f2=f0^f1;
	if(n==0) cout<<f0<<endl;
	else if(n==1) cout<<f1<<endl;
	else {
		for(int i=2; i<=n; i++){
			f2=f0^f1;
			f0=f1; f1=f2;
		}
		cout<<f2<<endl;
	}
}
0