CF1208A.XORinacci
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Cengiz recently learned Fibonacci numbers and now he is studying different algorithms to find them. After getting bored of reading them, he came with his own new type of numbers that he named XORinacci numbers. He defined them as follows:
- f(0)=a;
- f(1)=b;
- f(n)=f(n−1)⊕f(n−2) when n>1, where ⊕ denotes the bitwise XOR operation.
You are given three integers a, b, and n, calculate f(n).
You have to answer for T independent test cases.
辛吉兹最近学习了斐波那契数列,现在他正在研究各种求解它们的算法。在阅读这些算法感到厌倦后,他提出了自己定义的一类新数,称之为“XORinacci 数”。其定义如下:
- f(0)=a;
- f(1)=b;
- 当 n>1 时,f(n)=f(n−1)⊕f(n−2),其中 ⊕ 表示按位异或运算。
给定三个整数 a、b 和 n,请计算 f(n)。
你需要对 T 组相互独立的测试用例作答。
输入格式
The input contains one or more independent test cases.
The first line of input contains a single integer T (1≤T≤103), the number of test cases.
Each of the T following lines contains three space-separated integers a, b, and n (0≤a,b,n≤109) respectively.
输入包含一个或多个独立的测试用例。
输入的第一行包含一个整数 T(1≤T≤103),表示测试用例的数量。
接下来的 T 行中,每行包含三个以空格分隔的整数 a、b 和 n(0≤a,b,n≤109)。
输出格式
For each test case, output f(n).
对于每个测试用例,输出 f(n)。
输入输出样例
输入#1
3 3 4 2 4 5 0 325 265 1231232
输出#1
7 4 76
说明/提示
In the first example, f(2)=f(0)⊕f(1)=3⊕4=7.
在第一个例子中,f(2)=f(0)⊕f(1)=3⊕4=7。
输入解题思路,AI测评打分。不知道怎么写?