#include<stdio.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std ;
const int MAX=110000;
const int INF=1000000000;
double a[MAX];
double sqr(double x)
{
return x*x;
}
int main()
{
int saddr,n,k;
int m;
int i,j;
double avg;
while(scanf("%d",&n)!=EOF)
{
avg=0;
for(i=0;i<n;i++)
{
scanf("%lf",&a[i]);
avg+=a[i];
}
avg/=n;
double ans=0;
for(i=0;i<n;i++)
{
ans+=sqr(a[i]-avg);
}
printf("%.5f\n",sqrt(ans/n));
}
return 0;
}
2-05. 求集合数据的均方差(15)
最新推荐文章于 2022-03-06 19:25:45 发布