#include<iostream>
using namespace std;
#include<vector>
#include<cmath>
#include<iomanip>
int main()
{
int n;
cin >> n;
vector<int>nums(n);
for (int i = 0; i < n; ++i)
{
cin >> nums[i];
}
double average = 0.0;
for (int i = 0; i < n; ++i)
{
average += nums[i];
}
average /= n;
double j = 0.0;//方差
for (int i = 0; i < n; ++i)
{
j += (nums[i] - average) * (nums[i] - average);
}
j /= n;
double k = 0.0; //标准差
k = sqrt(j);
double ans = 0.0;
cout << fixed << setprecision(12);
for (int i = 0; i < n; ++i)
{
ans = (nums[i] - average) / k;
cout << ans << endl;
}
return 0;
}
CSP第26次CCF计算机软件能力认证 归一化处理
最新推荐文章于 2024-11-05 21:58:11 发布