QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#740579 | #8242. V-Diagram | HHS | WA | 102ms | 4068kb | C++14 | 708b | 2024-11-13 10:36:46 | 2024-11-13 10:36:46 |
Judging History
answer
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
using ll = long long;
typedef pair<ll,ll> PII;
const ll N = 105;
const ll INF = 1e18;
void solve(){
ll n; cin >> n;
vector <double> a(n + 1);
double sum = 0;
double x=1e9,point;
for (ll i = 1; i <= n; i++){
cin >> a[i];
if(a[i]<x)
{
x=a[i];
point=i;
}
sum += a[i];
}
double res=sum/n;
double cnt=n;
if(a[1]<res)
{
for(int i=1;i<=point-1;i++)
sum-=a[i],cnt--;
}
else if(a[n]<res)
{
for(int i=n;i>=point+1;i--)
sum-=a[i],cnt--;
}
printf("%.20lf\n", sum * 1.0 / cnt);
}
signed main(){
ios::sync_with_stdio(0), cin.tie(0);
ll t; cin >> t;
while(t--) solve();
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 4068kb
input:
2 4 8 2 7 10 6 9 6 5 3 4 8
output:
6.75000000000000000000 5.83333333333333303727
result:
ok 2 numbers
Test #2:
score: -100
Wrong Answer
time: 102ms
memory: 3788kb
input:
100000 3 948511478 739365502 813471668 3 881046825 27458122 398507422 3 987554257 399092415 924260278 3 984128569 125199021 716360525 3 529589236 45783262 313507287 3 645443456 85994112 226010681 3 914820717 228360911 572267310 3 418958362 56703604 195276041 3 64461646 26764720 26995581 3 914535039 ...
output:
843938490.00000000000000000000 454252473.50000000000000000000 770302316.66666662693023681641 608562705.00000000000000000000 296293261.66666668653488159180 365718784.00000000000000000000 571816312.66666662693023681641 237830983.00000000000000000000 45613183.00000000000000000000 474479951.500000000000...
result:
wrong answer 1st numbers differ - expected: '833782882.6666666', found: '843938490.0000000', error = '0.0121802'