fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5.  
  6. class Depo
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. double a1, a2, v01, v02, s, t, a, b, D;
  11. Scanner in = new Scanner(System.in);
  12. a1= in.nextDouble();
  13. a2= in.nextDouble();
  14. v01= in.nextDouble();
  15. v02= in.nextDouble();
  16. s= in.nextDouble();
  17. a= (a1 + a2)/2;
  18. b= v01 + v02;
  19. if(a == 0)
  20. t= s / b;
  21. else{
  22. D= b*b + 4*a*s;
  23. t=(-b + Math.sqrt(D))/(2*a);
  24. }
  25. System.out.println(t);
  26. }
  27. }
Success #stdin #stdout 0.18s 321344KB
stdin
3.2 2.1 3 7.5 20.8 1.45
stdout
1.4501855875021603