Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
32766 | lnx | 白细胞计数 | C++ | Accepted | 0 MS | 244 KB | 467 | 2023-12-02 19:33:04 |
#include<iostream> #include<iomanip> #include<cmath> using namespace std; int main() { int n; cin>>n; float a[n+1]; float p=2.0,q=300.0,s=0.0; for(int i=1;i<n+1;i++) { cin>>a[i]; p=max(p,a[i]); q=min(q,a[i]); s+=a[i]; } float x=(s-p-q)/(n-2.0); float b=0; for(int i=1;i<=n;i++) { if(a[i]!=p&&a[i]!=q) { float c=abs(a[i]-x); b=max(b,c); } } cout<<fixed<<setprecision(2)<<x<<" "<<fixed<<setprecision(2)<<b; }