Advertisement
Guest User

Untitled

a guest
Nov 16th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. public static void main(String[] args) throws FileNotFoundException {
  2. Scanner sc = new Scanner(new File("level2_1.in"));
  3.  
  4. int tuples = sc.nextInt();
  5.  
  6. for(int i=0;i<tuples;i++){
  7. Point p1 = new Point(sc.nextInt() + 0.5, sc.nextInt() + 0.5);
  8. Point p2 = new Point(sc.nextInt() + 0.5, sc.nextInt() + 0.5);
  9. double ratio = Double.parseDouble(sc.next());
  10.  
  11. Point p12 = new Point(p2.getRow() - p1.getRow(), p2.getCol() - p1.getCol());
  12.  
  13. double betrag = p12.getBetrag();
  14.  
  15. double betratio = betrag*ratio;
  16.  
  17. Point p13 = new Point(p12.getRow()*(betratio/betrag), p12.getCol()*(betratio/betrag));
  18. Point p14 = new Point(p13.getRow()+p1.getRow(), p1.getCol()+p13.getCol());
  19.  
  20. System.out.println(betratio + "");
  21. System.out.println(p14);
  22.  
  23.  
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement