QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#647650 | #8242. V-Diagram | travel# | WA | 0ms | 3780kb | C++14 | 981b | 2024-10-17 15:05:55 | 2024-10-17 15:05:56 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> PII;
#define endl "\n"
#define ft first
#define sd second
#define pb push_back
const int mod = 1e9 + 7,N = 3e5 + 10;
int a[N],n;
void solve() {
cin>>n;
double ans = 0.0;
int mx = 2e18,sum = 0;
for(int i = 1; i <= n; i++) {
cin>>a[i];
mx = min(mx,a[i]);
sum +=a[i];
}
int t = -1;
for(int i = 1; i <= n; i++) {
if(a[i] == mx)
{
t = i;
break;
}
}
int sum1 = 0,sum2 = 0;
for(int i = 1;i <= t + 1;i++)
sum1 +=a[i];
for(int i = t - 1;i <= n;i++)
sum2 +=a[i];
// cout<<sum<<' '<<sum1<<' '<<sum2<<endl;
ans = sum * 1.0 / n;
// cout<<sum1 * 1.0 / (t + 1)<<' '<<sum2 * 1.0 / (n - t + 2)<<sum * 1.0 / n<<endl;
ans = max(ans,max(sum1 * 1.0 / (t + 1),sum2 * 1.0 / (n - t + 2)));
printf("%.20lf",ans);
return ;
}
signed main() {
int T ;
cin>>T;
while(T--)
solve();
return 0;
}
/*
2
4
8 2 7 10
6
9 6 5 3 4 8
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3780kb
input:
2 4 8 2 7 10 6 9 6 5 3 4 8
output:
6.750000000000000000005.83333333333333303727
result:
wrong output format Expected double, but "6.750000000000000000005.83333333333333303727" found