Created
October 21, 2016 09:33
-
-
Save mohitkhosla01/3f733a0b5342c667b5864c607987e7dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class kangaroo { | |
public static void main(String[] args) { | |
Scanner sc=new Scanner(System.in); | |
int x1=sc.nextInt(); | |
int v1=sc.nextInt(); | |
int x2=sc.nextInt(); | |
int v2=sc.nextInt(); | |
if((x1>x2 && v1>v2) || (x1<x2 && v1<v2) || (x1!=x2 && v1==v2)|| (x1==x2 && v1!=v2)){ | |
System.out.println("NO"); | |
} | |
else if(((x1-x2)%(v2-v1))==0){ | |
System.out.println("YES"); | |
} | |
else{ | |
System.out.println("NO"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment