D. Xor – Codeforces Problem Solution in C++

Disclaimer: Make sure you tried enough before checking the solution

Problem: https://codeforces.com/group/MWSDmqGsZm/contest/223338/problem/D

#include<bits/stdc++.h>
using namespace std;
int main() {
	long long a,b,q;
	cin>>a>>b>>q;
	long long res = q % 3;
	if(res == 1){
		cout<<a;
	} else if (res == 2){
		cout<<b;
	} else {
		cout<<(a ^ b)<<endl;
	}
}

Assiut University Training – Newcomers Solution Math – Geometry

Leave a Comment