QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#623118 | #8242. V-Diagram | Zhou_JK | WA | 1ms | 3776kb | C++14 | 635b | 2024-10-09 10:14:48 | 2024-10-09 10:14:50 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=300005;
int n;
int a[N];
void solve()
{
cin>>n;
for(int i=1;i<=n;i++)
cin>>a[i];
int p=min_element(a+1,a+n+1)-a;
long long sum=0;
for(int i=1;i<=p+1;i++)
sum+=a[i];
double ans=(double)sum/(p+1);
sum=0;
for(int i=p-1;i<=n;i++)
sum+=a[i];
ans=max(ans,(double)sum/(n-p+2));
cout<<fixed<<setprecision(10)<<ans<<"\n";
return;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr),cout.tie(nullptr);
int T;
cin>>T;
while(T--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3776kb
input:
2 4 8 2 7 10 6 9 6 5 3 4 8
output:
6.7500000000 5.4000000000
result:
wrong answer 2nd numbers differ - expected: '5.8333333', found: '5.4000000', error = '0.0742857'