QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#613182#8242. V-DiagramHans#WA 0ms3860kbC++23661b2024-10-05 13:42:592024-10-05 13:43:00

Judging History

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

  • [2024-10-05 13:43:00]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3860kb
  • [2024-10-05 13:42:59]
  • 提交

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'