fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. double a, sum, b;
  13. int n;
  14. Scanner in = new Scanner(System.in);
  15. n = in.nextInt();
  16. b = 0;
  17. for(int i = 0; i < n; i++){
  18. a = in.nextInt();
  19. b += a;
  20. }
  21. sum = 2*b*b;
  22. System.out.printf("%.6f ",sum);
  23. }
  24. }
Success #stdin #stdout 0.14s 321344KB
stdin
3
1 2 3
stdout
72.000000