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.

Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter13: Decision Making Under Uncertainty
Section13.4: Decision Trees
Problem 5P
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
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr