Frog Contest On their way down the river, Jojo and Lili saw two frogs each in position X1 and X2. The two frogs are seen jumping happily towards the same direction that is come to Jojo. After watching the two frogs, Jojo and Lili saw that the speed the two frogs are different. The first frog to start jumping from position X1 has a speed of V1, while the second frog that starts to jump from position X2 has a speed of V2. Jojo guess that "YES" both frogs will be in the same position in a certain time T, while Bibi guessing "NO" the two frogs will never be in the same position in time the. Help Jojo and Lili calculate the frog's movements to determine whether the guess they are right. Input Format The first line of input consists of a series of integers namely X1, V1, X2, V2, T. X1 and V1 are the initial position and jump speed per second of the first frog. X2 and V2 are the starting position and jump speed per second of the second frog. T is the second when the frog jumps. Output Format A string "YES" or "NO" Constraints 1 ≤ T ≤ 104 0 ≤ X1, X2 ≤ 104 1 ≤ V1, V2 ≤ 104 Sample Input  0 3 4 2 10 Sample Output YES Sample Input 0 3 4 2 3 Sample Output NO In the sample above, let's say that frogs A and B start jumping together. Frog A starts jumping from position 0 at a speed of 3 per second. Then frog A's position per second: 3, 6, 9, 12, 15,… etc. Frog B starts jumping from position 4 at a rate of 2 per second. Then the position of frog B per second: 6, 8, 10, 12, 14,… etc. Within 3 seconds, the two frogs will NOT be in the same position. The two frogs can be in the same position in the fourth second, namely in position 12. So within 10 seconds the output is YES whereas within 3 seconds the output is NOT. Notes Even though it wasn't stated in the problem, by now you should know that the advantages spaces or lines are considered WRONG ANSWER.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Frog Contest

On their way down the river, Jojo and Lili saw two frogs each in position X1
and X2. The two frogs are seen jumping happily towards the same direction that is come to Jojo. After watching the two frogs, Jojo and Lili saw that the speed the two frogs are different. The first frog to start jumping from position X1 has a speed of V1, while the second frog that starts to jump from position X2 has a speed of V2. Jojo guess that "YES" both frogs will be in the same position in a certain time T, while Bibi
guessing "NO" the two frogs will never be in the same position in time
the. Help Jojo and Lili calculate the frog's movements to determine whether the guess they are right.

Input Format
The first line of input consists of a series of integers namely X1, V1, X2, V2, T.
X1 and V1 are the initial position and jump speed per second of the first frog.
X2 and V2 are the starting position and jump speed per second of the second frog.
T is the second when the frog jumps.

Output Format
A string "YES" or "NO"

Constraints
1T104
0X1, X2104
1V1, V2104

Sample Input 
0 3 4 2 10

Sample Output

YES


Sample Input
0 3 4 2 3

Sample Output

NO

In the sample above, let's say that frogs A and B start jumping together.
Frog A starts jumping from position 0 at a speed of 3 per second.
Then frog A's position per second: 3, 6, 9, 12, 15,… etc.
Frog B starts jumping from position 4 at a rate of 2 per second.
Then the position of frog B per second: 6, 8, 10, 12, 14,… etc.
Within 3 seconds, the two frogs will NOT be in the same position. The two frogs can be in the same position in the fourth second, namely in position 12. So within 10 seconds the output is YES whereas within 3 seconds the output is NOT.

Notes
Even though it wasn't stated in the problem, by now you should know that the advantages spaces or lines are considered WRONG ANSWER.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education