fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class Ideone
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. double a,b,c,d,f,p1,p2,S1,S2,S;
  10. Scanner in = new Scanner(System.in);
  11. a = in.nextDouble();
  12. b = in.nextDouble();
  13. c = in.nextDouble();
  14. d = in.nextDouble();
  15. f = in.nextDouble();
  16. p1=(a+b+f)/2;
  17. p2=(c+d+f)/2;
  18. S = Math.sqrt(p1*(p1-a)*(p1-b)*(p1-f)) + Math.sqrt(p2*(p2-c)*(p2-d)*(p2-f));
  19. System.out.printf("%.4f",S);
  20.  
  21. }
  22. }
Success #stdin #stdout 0.07s 2184192KB
stdin
2 2 2 2 2
stdout
3.4641