求助WA on #10
查看原帖
求助WA on #10
684031
皓月星辉楼主2025/1/30 19:46
#include<bits/stdc++.h>
using namespace std;
long long s,n,t1,t2,x;
int main()
{
  cin>>n;
  for(int i=0;i<n;i++)
  {
    cin>>x;
    s+=x;
  }
  t1=s/(n-2)*(n-2);
  t2=s-t1;
  t1=(s-t2)/(n-2);
  if(t2==0)
  {
    cout<<fixed<<setprecision(16)<<2.0*sqrt(t1*1.0*t1+1.0)+n*1.0-3.0;
    return 0;
  }
  else if(t2==n-3)
  {
    cout<<fixed<<setprecision(16)<<sqrt((t1*1.0+1.0)*(t1*1.0+1.0)*1.0+1.0)+sqrt(t1*t1*1.0+1.0)+sqrt(2.0)+n*1.0-4.0;
  }
  else
  {
    cout<<fixed<<setprecision(16)<<2.0*sqrt(t1*t1*1.0+1.0)+sqrt(8.0)+n*1.0-5.0;
  }
  return 0;
}
2025/1/30 19:46
加载中...