1 #include <iostream> 2 #include <vector> 3 #include <math.h> 4 5 int main(){ 6 int x{},sum{}; 7 std::cin>>x; 8 std::vector<int> n(x,0); 9 10 for(int i{};i<x;i++){ 11 std::cin>>n[i]; 12 sum+=n[i]; 13 } 14 double a{},d{},tmp{}; 15 a=static_cast<double>(sum)/x; 16 17 for(int i{};i<x;i++){ 18 tmp = n[i]-a; 19 tmp *= tmp; 20 d += tmp; 21 } 22 d *= (1/static_cast<double>(x)); 23 24 for(int i{};i<x;i++){ 25 tmp = (n[i] - a)/sqrt(d); 26 std::cout<<tmp<<std::endl; 27 } 28 }
标签:202206,int,sum,C++,归一化,include,CSP From: https://www.cnblogs.com/n00b/p/16896161.html