QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#364270#8242. V-DiagramzhouyuhengWA 0ms3848kbC++141.2kb2024-03-24 13:23:402024-03-24 13:23:41

Judging History

你现在查看的是最新测评结果

  • [2024-03-24 13:23:41]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3848kb
  • [2024-03-24 13:23:40]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
typedef pair<int,int> pii;
template <typename T> inline T gcd(const T a,const T b){if(b==0)return a;return gcd(b,a%b);}
template <typename T> inline void read(T&x)
{
    char cu=getchar();x=0;bool fla=0;
    while(!isdigit(cu)){if(cu=='-')fla=1;cu=getchar();}
    while(isdigit(cu))x=x*10+cu-'0',cu=getchar();
    if(fla)x=-x; 
}
template <typename T> void printe(const T x)
{
    if(x>=10)printe(x/10);
    putchar(x%10+'0');
}
template <typename T> inline void print(const T x)
{
    if(x<0)putchar('-'),printe(-x);
    else printe(x);
}
const ll mod=998244353;
inline ll Pow(ll x,ll y)
{
	ll res=1;//x%=mod
	for(;y;y>>=1,x=x*x%mod)if(y&1)res=(res*x)%mod;
	return res;
}
ll T,n,a[300005],sum,cnt;
double ans;
int main(){
	read(T);
	while(T--){
		read(n);
		sum=0;
		for(int i=1;i<=n;i++)read(a[i]),sum+=a[i];
		ans=1.0*sum/n;
		cnt=0;
		for(int i=1;i<=n;i++){
			if(a[i+1]<a[i+2])break;
			cnt+=a[i];
			ans=max(ans,1.0*(sum-cnt)/(n-i));
		}
		cnt=0;
		for(int i=n;i>=1;i--){
			if(a[i-1]<a[i-2])break;
			cnt+=a[i];
			ans=max(ans,1.0*(sum-cnt)/(i-1));
		}
		printf("%lf\n",ans);
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3848kb

input:

2
4
8 2 7 10
6
9 6 5 3 4 8

output:

6.750000
5.833333

result:

wrong answer 2nd numbers differ - expected: '5.8333333', found: '5.8333330', error = '0.0000001'