➽ Problem:-
https://www.hackerrank.com/challenges/kangaroo/problem
➽ Solution:-
import java.util.*;
import
java.io.*;
class
Solution
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int x1, x2, v1, v2;
x1 = sc.nextInt();
v1 = sc.nextInt();
x2 = sc.nextInt();
v2 = sc.nextInt();
if(v1>v2 && (x2-x1) %
(v1-v2) == 0)
System.out.println("YES");
else
System.out.println("NO");
}
}
0 Comments
Please do not enter any spam link in the comment section.