[NOIP simulation test]: solution of the equation (Elementary Mathematical Olympiad)

Title Description

A given linear equations ax + by = c, where x, y are unknown, it is seeking the number of positive integer solutions.


Input Format

A first line integer T, T set of data expressed.
Next T lines of three integers a, b, c.


Output Format

T output lines, each a number representing the number of solutions of the equations.
If the number of positive integer solutions more than the 65535, the output "ZenMeZheMeDuo".


Sample

Sample input:

3
-1 -1 -3
1 1 65536
1 1 65537

Sample output:

2
65535
ZenMeZheMeDuo


Data range and tips

20% of the data, $ a = b = 1 $ .
40% of the data, $ T \ leqslant 100,1 \ leqslant a, b, c \ leqslant 1000 $.
Another 20% of the data, $ A + B = C,. 1 \ leqslant A, B, C \ leqslant $ 1, 000,000 .
Another 20% of the data, $. 1 \ leqslant A, B, C \ leqslant $ 1, 000,000 .
100% of the data, $ T \ leqslant 10,000, -1,000,000 \ leqslant A, B, C \ leqslant $ 1, 000,000 .

 

Guess you like

Origin www.cnblogs.com/wzc521/p/11225874.html