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.

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter4: The Selection Structure
Section: Chapter Questions
Problem 1MQ6
icon
Related questions
Question
100%

Help Me With C Programming

 

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.

 

Constraints
1<T< 10*
0< X1,X2< 104
1<V1,V½ < 10*
Sample Input
0 3 4 2 10
Sample Output
YA
Sample Input
0 3 4 2 3
Sample Output
TIDAK
Transcribed Image Text:Constraints 1<T< 10* 0< X1,X2< 104 1<V1,V½ < 10* Sample Input 0 3 4 2 10 Sample Output YA Sample Input 0 3 4 2 3 Sample Output TIDAK
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage