QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#635062#8242. V-DiagramwangjunruiWA 0ms3896kbC++14870b2024-10-12 18:54:252024-10-12 18:54:25

Judging History

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

  • [2024-10-12 18:54:25]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3896kb
  • [2024-10-12 18:54:25]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int N = 1e5 + 5;
int n, a[N];
ll sum[N];
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
    int tt = 1;
    cin >> tt;
    while (tt--)
    {
        int n, pos;
        cin >> n;
        sum[0] = 0;
        int mn = INT_MAX;
        for (int i = 1; i <= n; i++)
        {
            cin >> a[i];
            if (a[i] < mn)
            {
                mn = a[i];
                pos = i;
            }
            sum[i] = sum[i - 1] + a[i];
        }
        long double mx = 0.0;
        mx = max({(long double) 1.0 * (sum[n] - sum[0]) / n, (long double) 1.0 * (sum[pos + 1] - sum[0]) / (pos + 1),
                  (long double) 1.0 * (sum[n] - sum[pos - 2]) / (n - pos + 2)});
        cout << mx << '\n';
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

6.75
5.83333

result:

wrong answer 2nd numbers differ - expected: '5.8333333', found: '5.8333300', error = '0.0000006'