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) {
  11. Scanner in = new Scanner(System.in);
  12. int n = in.nextInt();
  13. int[] arr = new int[n];
  14. double sum = 0.0;
  15. for(int i = 0; i < n; i++) {
  16. arr[i] = in.nextInt();
  17. }
  18. Arrays.sort(arr);
  19. double mean = 0;
  20. for(int i = 0; i < n; i++) {
  21. mean += arr[i];
  22. }
  23. mean /= n;
  24. for(int i = 0; i < n; i++) {
  25. sum += Math.pow(arr[i] - mean,2);
  26. }
  27. System.out.printf("%.1f", Math.sqrt(sum/n));
  28. }
  29. }
Success #stdin #stdout 0.06s 711680KB
stdin
10

64630 11735 14216 99233 14470 4978 73429 38120 51135 67060
stdout
30466.9