直接上代码:C语言:include<stdio.h>include<algorithm>voidmean(floatdata,intlen,float&mean,float&max,float&min){floatsumdata[0];maxdata[0];mindata[0];for(inti1;i<len;i){sumdata[i];if(data[i]>max)maxdata[i];if(data[i]<min)mindata[i];}meansumlen;}voidnormalize(floatdata,intlen){floatm0.0;floatmx0.0;floatmn0.0;mean(data,len,m,mx,mn);printf("mean:%f\nmax:%f\nmin:%f\n",m,mx,mn);for(inti0;i<len;i){data[i](data[i]m)(mxmn);}}Python:defNormalize(data):mnp.mean(data)mxmax(data)mnmin(data)return[(float(i)m)(mxmn)foriindata]作者:aiexception来源:CSDN