#P7042. 「MCOI-03」正方
「MCOI-03」正方
Description
Given a square, find how many points inside the square satisfy that the ratio of the areas of the four parts divided by the four vertices of the square is . The four numbers are unordered.
For example, as shown in the figure below, suppose there is a point such that the area ratio of the four triangles is , then point meets the requirement. Since the order does not matter, a ratio like is also acceptable. However, point is not the only solution; you need to output the number of solutions.

Since little S, little Q, little U, little A, little R, and little E like asking questions very much, this problem provides queries.
Input Format
The first line contains an integer , representing the number of queries.
The next lines each contain four integers .
Output Format
Output lines, each line containing an integer representing the answer.
3
1 3 3 1
2 4 7 8
2 3 1 4
4
0
8
Hint
Constraints
For of the testdata, .
For of the testdata, , . It is not guaranteed that is in simplest form, and it is not guaranteed that are in increasing order.
Translated by ChatGPT 5
京公网安备 11011102002149号