QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#635062 | #8242. V-Diagram | wangjunrui | WA | 0ms | 3896kb | C++14 | 870b | 2024-10-12 18:54:25 | 2024-10-12 18:54:25 |
Judging History
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'