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.
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
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.
First line contains integers .
The next line contains , the number of queries.
Each of the next lines consists of one integer in one line.
10 1 2
For the first case, note that the answer is around 4.1421356237..., so any of the following will be accepted: