QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#623118#8242. V-DiagramZhou_JKWA 1ms3776kbC++14635b2024-10-09 10:14:482024-10-09 10:14:50

Judging History

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

  • [2024-10-09 10:14:50]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3776kb
  • [2024-10-09 10:14:48]
  • 提交

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;
}

详细

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'