Created
May 7, 2020 14:44
-
-
Save kryvoboker/07aefc2fec39c5afefa03ac2570dac00 to your computer and use it in GitHub Desktop.
HomeWork3
This file contains 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; | |
/** | |
* | |
* @author kamaz | |
*/ | |
public class Main { | |
public static void main(String [] args) { | |
Scanner sc = new Scanner(System.in); // решение второго задания второго уровня | |
int xA = 0; | |
int yA = 0; | |
int xB = 4; | |
int yB = 4; | |
int xC = 6; | |
int yC = 1; | |
int vectorAB = (int) Math.sqrt(Math.pow((xB - xA), 2) + Math.pow((yB - yA), 2)); | |
int vectorAC = (int) Math.sqrt(Math.pow((xC - xA), 2) + Math.pow((yC - yA), 2)); | |
int vectorBC = (int) Math.sqrt(Math.pow((xC - xB), 2) + Math.pow((yC - yB), 2)); | |
System.out.println("Enter xD"); | |
int xD = sc.nextInt(); | |
System.out.println("Enter yD"); | |
int yD = sc.nextInt(); | |
int vectorD = (int) Math.sqrt(Math.pow(xD, 2) + Math.pow(yD, 2)); | |
if ((vectorD <= vectorAB) || (vectorD <= vectorAC) || (vectorD <= vectorBC)) { | |
System.out.println("Ok"); | |
} | |
else { | |
System.out.println("Poorly"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment