QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#637714 | #8242. V-Diagram | Moemi_ | WA | 0ms | 3752kb | C++20 | 1.4kb | 2024-10-13 13:54:14 | 2024-10-13 13:54:15 |
Judging History
answer
#include <iostream>
#include <cstring>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <cmath>
#include <stack>
#include <cstring>
#include <iomanip>
#include <unordered_map>
#include <numeric>
#define sc_int(x) scanf("%d", &x)
#define x first
#define y second
#define pb push_back
using namespace std;
const int N = 510, M = 2e5 + 10, MOD = 1e9 + 7;
const int inf = 1e9;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<string, int> PSI;
typedef pair<LL, LL> PLL;
typedef pair<double, double> PDD;
typedef pair<char, int> PCI;
typedef pair<string, string> PSS;
int n, m;
void solve()
{
cin >> n;
vector<LL> a(n + 1);
LL sum = 0;
for(int i = 1; i <= n; i ++) cin >> a[i], sum += a[i];
int pos = 0;
for(int i = 1; i <= n - 1; i ++)
{
if(a[i] < a[i + 1])
{
pos = i;
break;
}
}
if(sum >= a[1] * n)
{
for(int i = 1; i < pos - 1; i ++) sum -= a[i], n --;
}
else
{
for(int i = n; i > pos + 1; i --) sum -= a[i], n --;
}
printf("%.15lf\n", 1.0 * sum / n);
}
int main()
{
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
// ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
int T = 1;
cin >> T;
while(T --)
{
solve();
}
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3752kb
input:
2 4 8 2 7 10 6 9 6 5 3 4 8
output:
5.666666666666667 5.400000000000000
result:
wrong answer 1st numbers differ - expected: '6.7500000', found: '5.6666667', error = '0.1604938'