On their way down the river, Jojo and Lili saw two frogs in X1 and X2 respectively. The two frogs are seen jumping up and down happily in the same direction, which is coming to Jojo. After noticing the two frogs, Jojo and Lili noticed that the speed of the two frogs was different. The first frog to start jumping from the X1 position has a speed of V1, while the second frog that starts jumping from the X2 position has a V2 speed. Jojo guessed that the "YES" of the two frogs would be in the same position in a given T time, while Bibi guessed the "NO" of the two frogs would never be in the same position in that time. Help Jojo and Lili take into account the frog's movements to determine if their guess is correct.
Help Me With C
On their way down the river, Jojo and Lili saw two frogs in X1 and X2 respectively. The two frogs are seen jumping up and down happily in the same direction, which is coming to Jojo. After noticing the two frogs, Jojo and Lili noticed that the speed of the two frogs was different. The first frog to start jumping from the X1 position has a speed of V1, while the second frog that starts jumping from the X2 position has a V2 speed. Jojo guessed that the "YES" of the two frogs would be in the same position in a given T time, while Bibi guessed the "NO" of the two frogs would never be in the same position in that time. Help Jojo and Lili take into account the frog's movements to determine if their guess is correct.
Format Input
The first line of input consists of a series of integers namely X1, V1, X2, V2, T.
X1 and V1 are the starting positions and jumping speeds per second of the first frog. X2 and V2 are the starting positions and jumping speeds per second frog.
T is the second when the frog jumps.
Format Output
A string of "YES" or "NO"
[Look at Image]
In the sample above, for example frogs A and B begin to compete to jump.
Frog A starts jumping from position 0 at a speed of 3 per second.
Then the position of frog A per second: 3, 6, 9, 12, 15,... Dst.
Frog B starts jumping from position 4 at a speed of 2 per second.
Then the position of frog B per second: 6, 8, 10, 12, 14,... Dst.
Within 3 seconds, the two frogs will NOT be in the same position. Both frogs can be in the same position in the fourth second, which is in the 12th position. So that within 10 seconds the output is YES while within 3 seconds the output is NOT.
Step by step
Solved in 2 steps