Problem:
Standard Deviation

You have final scores of an examination for n students. Calculate standard deviation of the scores s1, s2 ... sn.

The variance α2 is defined by

α2 = (∑ni=1(si - m)2)/n

where m is an average of si.

The standard deviation of the scores is the square root of their variance.

Input

The input consists of multiple datasets. Each dataset is given in the following format:

n
s1 s2 ... sn

The input ends with single zero for n.

Output

For each dataset, print the standard deviation in a line. The output should not contain an absolute error greater than 10-4.

Constraints

n ≤ 1000

0 ≤ si ≤ 100

Sample Input

5
70 80 100 90 20
3
80 80 80
0

Sample Output

27.85677655
0.00000000

Solution in JAVA (judge verdict: Wrong Answer)

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{

	public static void main(String[] args) throws IOException {
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

		while (true) {

			String first_line = input.readLine();

			// ????????°??¨?????°
			int student_num = Integer.parseInt(first_line);

			if (student_num == 0) {

				break;

			}

			// ????????\?????¨?????°
			String secound_lines = input.readLine();

			String[] score_arrays = secound_lines.split(" ");

			// ?????°???????¨???¨?????°
			int score_sum = 0;

			//n???????????????????????????????????°?????????
			for (int score_spot = 0; score_spot < score_arrays.length; score_spot++) {

				int score = Integer.parseInt(score_arrays[score_spot]);

				score_sum += score;

			}

			//???????????????
			double average = score_sum / score_arrays.length;

			//??°???a???2???
			double sequence_a_square = 0;

			//??°???a???2??????????????????
			for (int sequence_spot = 0; sequence_spot < score_arrays.length; sequence_spot++) {

				double score = Double.parseDouble(score_arrays[sequence_spot]);
				

				sequence_a_square += Math.pow(score - average, 2);

			}

			double distributed_a_square = sequence_a_square / student_num;

			//??°???a????????????
			double square_a = Math.sqrt(distributed_a_square);

			System.out.println(square_a);
		}

	}

}