QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#613182 | #8242. V-Diagram | Hans# | WA | 0ms | 3860kb | C++23 | 661b | 2024-10-05 13:42:59 | 2024-10-05 13:43:00 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
void solve(void) {
int a1, a2, a3;
int n; cin >> n;
double ave1 = 0, ave2 = 0, ave3 = 0;
bool isDescending = true;
for (int i = 0; i < n; i++) {
a3 = a2;
a2 = a1;
cin >> a1;
ave1 = (i*ave1 + a1)/(i+1);
if (isDescending)
ave2 = (i*ave2 + a1)/(i+1);
else {
ave3 = (i*ave3 + a1)/(i+1);
}
if (isDescending && a1 > a2) {
isDescending = false;
ave3 = (double)(a1 + a2 + a3)/3;
}
}
printf("%.20f\n", max(ave1, max(ave2, ave3)));
}
int main(void) {
int n; cin >> n;
while (n--)
solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3860kb
input:
2 4 8 2 7 10 6 9 6 5 3 4 8
output:
87837201.41666667163372039795 5.83333333333333303727
result:
wrong answer 1st numbers differ - expected: '6.7500000', found: '87837201.4166667', error = '13012917.7283951'