Answered step by step
Verified Expert Solution
Question
1 Approved Answer
John is given 2 square tiles, initially both of whose sides have length l placed in an x - y plane. Initially, the bottom left
John is given square tiles, initially both of whose sides have length l placed in an x y plane. Initially, the bottom left corners of each square are at the origin and their sides are parallel to the axes.
At t both squares start moving along line y x along the positive x and y with velocities s and s
For each querydetermine the time at which the overlapping area of tiles is equal to the query value, queriesi
Note: Assume all distances are in meters, time in seconds and velocities in meters per second.
This squares are going the same direction xy line.
Function Description:
Complete the movingTiles function in java below.
movingTiles has the following parameters:
int l: side length for the squares.
int s: velocity of square
int s: velocity of square
int queriesq: the array of queries.
Returns:
int: 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 l s s
The next line contains q the number of queries.
Each of the next q lines consists of one integer queriesi in one line.
Sample Input
Sample Output
Explanation
For the first case, note that the answer is around so any of following will be accepted:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started