Home => ProblemSet => 2.12-26:数组异或操作
Problem1508--2.12-26:数组异或操作

1508: 2.12-26:数组异或操作

Time Limit: 1 Sec  Memory Limit: 128 MB  Submit: 0  Solved: 1
[ Submit ] [ Status ] [ Creator: ][ 参考程序 ]

Description

给你两个整数,n 和 start 。

数组 nums 定义为:nums[i] = start + 2*i(下标从 0 开始)且 n == nums.length 。

请返回 nums 中所有元素按位异或(XOR)后得到的结果。

Input

一行两个整数n和start

Output

一行一个整数

Sample Input Copy

5 0

Sample Output Copy

8

HINT

样例一解释:
数组 nums 为 [0, 2, 4, 6, 8],其中 (0 ^ 2 ^ 4 ^ 6 ^ 8) = 8 。


样例二:
输入:
4 3
输出:
8
解释:
数组 nums 为 [3, 5, 7, 9],其中 (3 ^ 5 ^ 7 ^ 9) = 8


1 <= n <= 1000
0 <= start <= 1000

Source/Category