← 返回 microsoft 的题目列表Maximum XOR Product
类型:online_judge
Problem: Maximum XOR Product
Given three non-negative integers a, b, and n, choose an integer x satisfying:
0 <= x < 2^n
such that the following product is maximized:
(a XOR x) * (b XOR x)
Return the maximum product modulo 1_000_000_007.
Here, XOR denotes the bitwise exclusive-or operation.
Input Format
One line containing three integers: a b n.
Output Format
Print the maximum possible product modulo 1000000007.
Example
Input:
12 5 4
Output:
98
One optimal choice is x = 2:
(12 XOR 2) * (5 XOR 2) = 14 * 7 = 98
Constraints
0 <= a, b < 2^50
0 <= n <= 50
Return the result modulo 1_000_000_007.
Example
Input
12 5 4
Output
98