fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class Main
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. int s, a;
  10. double h, dk;
  11. Scanner in = new Scanner(System.in);
  12. s = in.nextInt();
  13. a = in.nextInt();
  14. dk = Math.sqrt(a*a + 8*s);
  15. h = (-a + dk) / 2;
  16. System.out.printf("%.2f",h);
  17. }
  18. }
Success #stdin #stdout 0.07s 2184192KB
stdin
20 7
stdout
3.73