Codeforces 1208A. XORinacci Solution

Solve in C++:

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,n,i,t,r=0;
    while(cin>>t)
    {
        for(i=0; i<t; i++)
        {
            cin>>a>>b>>n;
            {

                if(n%3==1)
                    cout<<b<<endl;
                else if(n%3==0)
                    cout<<a<<endl;
                else
                {
                    r=a^b;
                    cout<<r<<endl;
                    r=0;
                }


            }

        }
    }
}

No comments

Most View Post

Recent post

Codeforces Round 925 (Div. 3) 1931D. Divisible Pairs Solution

    Problem Link  :   https://codeforces.com/contest/1931/problem/D S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. ...

Powered by Blogger.