ArtemisL

H2 in LOSH 2016

Jul 27th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
4CS 0.81 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.  
  6.         // ТОЧКА ПЕРЕСЕЧЕНИЯ БИССЕКТРИС
  7.  
  8.         Scanner sc = new Scanner(System.in);
  9.         double x1 = sc.nextDouble();
  10.         double y1 = sc.nextDouble();
  11.  
  12.         double x2 = sc.nextDouble();
  13.         double y2 = sc.nextDouble();
  14.  
  15.         double x3 = sc.nextDouble();
  16.         double y3 = sc.nextDouble();
  17.  
  18.         double AB = Math.sqrt(Math.pow(x2-x1,2) + Math.pow(y2-y1,2));
  19.         double AC = Math.sqrt(Math.pow(x3-x1,2) + Math.pow(y3-y1,2));
  20.         double BC = Math.sqrt(Math.pow(x3-x2,2) + Math.pow(y3-y2,2));
  21.  
  22.         double corx = (BC*x1+AC*x2+AB*x3)/(BC+AC+AB);
  23.         double cory = (BC*y1+AC*y2+AB*y3)/(BC+AC+AB);
  24.         System.out.println(corx + " " + cory);
  25.     }
  26. }
Add Comment
Please, Sign In to add comment