标签:bsp str ora min sha har turn scan include
#include<iostream> #include<cstdio> #include<cmath> using namespace std; double x[1001],y[1001],maxx=-10001,minn=10001; double a,s,d; int main() { int n,m,k,v; scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%lf",&y[i]); } for(int i=1;i<=n;i++) { s+=y[i]; if(y[i]>maxx)maxx=y[i],k=i; if(y[i]<minn)minn=y[i],v=i; } a=(s-maxx-minn)/(n-2.00); printf("%.2lf ",a); for(int i=1;i<=n;i++) { if(i!=k&&i!=v) { x[i]=abs(a-y[i]); } else x[i]=-10001; maxx=-10001; } for(int i=1;i<=n;i++) { if(x[i]>maxx)maxx=x[i]; } printf("%.2lf",maxx); return 0; }
标签:bsp str ora min sha har turn scan include
原文地址:https://www.cnblogs.com/xrj1229/p/9231409.html