Sherlock is given square tiles, initially both of whose sides have length placed in an plane. Initially, the bottom left corners of each square are at the origin and their sides are parallel to the axes.
At , both squares start moving along line (along the positive and ) with velocities and .
For each querydetermine the time at which the overlapping area of tiles is equal to the query value, .
Note: Assume all distances are in meters, time in seconds and velocities in meters per second.
Function Description
Complete the movingTiles function in the editor below.
movingTiles has the following parameter(s):
- int l: side length for the two squares
- int s1: velocity of square 1
- int s2: velocity of square 2
- int queries[q]: the array of queries
Returns
- int[n]: an array of answers to the queries, in order. Each answer will be considered correct if it is at most away from the true answer.
Input Format
First line contains integers .
The next line contains , the number of queries.
Each of the next lines consists of one integer in one line.
Constraints
Sample Input
10 1 2
2
50
100
Sample Output
4.1421
0.0000
Explanation
For the first case, note that the answer is around 4.1421356237...
, so any of the following will be accepted:
4.1421356237
4.14214
4.14215000
4.1421
4.1422