ZOJ Problem Set - 3458
Give you two positive integers a and b, which satisfies 0 < b-a < 1+2sqrt(a), together with a positive even number n, please calculate the value of floor((sqrt(a)+sqrt(b))^n) % 2(a+b).
There are multiple test cases. Each test case include three integers a, b and n (1 <= a <= 10000, 1 <= b <= 10000, 2 <= n <= 10^9).
For each test case, output an single line contains the value of the formula described above.
21 29 1998
Author: JIANG, Kai
Contest: ZOJ Monthly, January 2011