#include <stdio.h>
#define ARRAY_SIZE_MAX 1024
int main(void)
{
// рабочие переменные
double avg = 0;
double disp = 0;
int i;
int k;
double x[ARRAY_SIZE_MAX];
// проверка ввода числа итераций
if( scanf("%d", &k ) < 1 )
{
printf("error: incomplete input of k\n");
return 0;
}
if( k <= 1 || k > ARRAY_SIZE_MAX )
{
printf("error: wrong value of k\n");
return 0;
}
// вычисление среднего значения
for( i = 0; i < k; i++ )
{
if( scanf("%lf", &x[i] ) < 1 )
{
printf("error: incomplete input of x\n");
return 0;
}
avg += x[i];
}
avg /= k;
// вычисление дисперсии
for( i = 0; i < k; i++ )
{
disp += ( x[i] - avg ) * ( x[i] - avg );
}
disp /= ( k - 1 );
// вывод результата
printf("%lf\n", avg);
printf("%lf", disp);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgojZGVmaW5lIEFSUkFZX1NJWkVfTUFYIDEwMjQKCmludCBtYWluKHZvaWQpCnsKICAgLy8g0YDQsNCx0L7Rh9C40LUg0L/QtdGA0LXQvNC10L3QvdGL0LUKICAgZG91YmxlIGF2ZyA9IDA7CiAgIGRvdWJsZSBkaXNwID0gMDsKICAgaW50IGk7CiAgIGludCBrOwogICBkb3VibGUgeFtBUlJBWV9TSVpFX01BWF07CiAgIAogICAvLyDQv9GA0L7QstC10YDQutCwINCy0LLQvtC00LAg0YfQuNGB0LvQsCDQuNGC0LXRgNCw0YbQuNC5CiAgIGlmKCBzY2FuZigiJWQiLCAmayApIDwgMSApCiAgIHsKICAgICAgcHJpbnRmKCJlcnJvcjogaW5jb21wbGV0ZSBpbnB1dCBvZiBrXG4iKTsKICAgICAgcmV0dXJuIDA7CiAgIH0KICAgaWYoIGsgPD0gMSB8fCBrID4gQVJSQVlfU0laRV9NQVggKQogICB7CiAgICAgIHByaW50ZigiZXJyb3I6IHdyb25nIHZhbHVlIG9mIGtcbiIpOwogICAgICByZXR1cm4gMDsKICAgfQogICAKICAgLy8g0LLRi9GH0LjRgdC70LXQvdC40LUg0YHRgNC10LTQvdC10LPQviDQt9C90LDRh9C10L3QuNGPCiAgIGZvciggaSA9IDA7IGkgPCBrOyBpKysgKQogICB7CiAgICAgIGlmKCBzY2FuZigiJWxmIiwgJnhbaV0gKSA8IDEgKQogICAgICB7CiAgICAgICAgIHByaW50ZigiZXJyb3I6IGluY29tcGxldGUgaW5wdXQgb2YgeFxuIik7CiAgICAgICAgIHJldHVybiAwOwogICAgICB9CiAgICAgIGF2ZyArPSB4W2ldOwogICB9CiAgIGF2ZyAvPSBrOwogICAKICAgLy8g0LLRi9GH0LjRgdC70LXQvdC40LUg0LTQuNGB0L/QtdGA0YHQuNC4CiAgIGZvciggaSA9IDA7IGkgPCBrOyBpKysgKQogICB7CiAgICAgZGlzcCArPSAoIHhbaV0gLSBhdmcgKSAqICggeFtpXSAtIGF2ZyApOwogICB9CiAgIGRpc3AgLz0gKCBrIC0gMSApOwogICAKICAgLy8g0LLRi9Cy0L7QtCDRgNC10LfRg9C70YzRgtCw0YLQsAogICBwcmludGYoIiVsZlxuIiwgYXZnKTsKICAgcHJpbnRmKCIlbGYiLCBkaXNwKTsKICAgCiAgIHJldHVybiAwOwp9