Submit | All submissions | Best solutions | Back to list |
ADAM1 - Adrita and Marbles |
Adrita loves to play with marbles at home. She has a circular table on her living room. Let it be stuck on the ground and the ground be a 2D space having only 2 coordinates x and y. She knows the equation of the circle to be x^2 + y^2 - px - qy + z = 0
She has N number of marbles of radius 1 unit. The table is not polished and Adrita has some coordinates where she wants to put the marbles.
Help her calculating the number of marbles she will place on the table. Consider the thickness of the table is negligible and if the center is on the border of the table the marble is considered to be on the table.
Input
The first line contains an integer T (1 <= T <= 10) denoting number of test cases and then T set of input follows of which. the first line contains values of p, q, z (1 <= p, q, z <= 10^6) of the equation x^2 + y^2 - px - qy + z = 0 and the next line contains an integer N (1 <= N <= 10^6) denoting the number of marbles Adrita has and then another N lines follows containing x, y ( -10^5 <= x, y <= 10^5) denoting the coordinates of the marbles.
Output
Print the number of marbles on the table.
Example
Input: 1 100 250 8125 5 30 10 -100 100 20 5 100 100 -30 10 Output: 1
Added by: | Sarwar |
Date: | 2017-12-30 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
hide comments