fork download
  1. #include <iostream>
  2. #define ll long long
  3. using namespace std;
  4.  
  5. void solve(ll a,ll b,ll q)
  6. {
  7. if(q % 3 == 1) cout << a;
  8. else if(q % 3 == 2) cout << b;
  9. else{
  10. cout << (a^b);
  11. }
  12. }
  13. int main() {
  14. ll a,b,q;
  15. cin >> a >> b >> q;
  16. solve(a,b,q);
  17. return 0;
  18. }
Success #stdin #stdout 0s 5276KB
stdin
5 3 1
stdout
5