QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#622617 | #8242. V-Diagram | ggggggg | WA | 71ms | 3928kb | C++14 | 558b | 2024-10-08 23:19:50 | 2024-10-08 23:19:50 |
Judging History
answer
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define ll long long
using namespace std;
const int N=300005;
int n,a[N];
void solve(){
scanf("%d",&n);
rep(i,1,n) scanf("%d",&a[i]);
ll s1=0,s2=0;
int p=min_element(a+1,a+n+1)-a;
rep(i,1,p) s1+=a[i];
rep(i,p,n) s2+=a[i];
double as=max(1.0*s1/p,1.0*s2/(n-p+1));
as=max(as,1.0*(s1+s2-a[p])/n);
printf("%.10lf\n",as);
}
int main(){
int T;
scanf("%d",&T);
while(T--) solve();
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3876kb
input:
2 4 8 2 7 10 6 9 6 5 3 4 8
output:
6.7500000000 5.8333333333
result:
ok 2 numbers
Test #2:
score: -100
Wrong Answer
time: 71ms
memory: 3928kb
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.0000000000 454252473.5000000000 770302316.6666666269 608562705.0000000000 296293261.6666666865 365718784.0000000000 571816312.6666666269 237830983.0000000000 45613183.0000000000 474479951.5000000000 742247812.0000000000 779975824.3333333731 503399231.5000000000 645879534.5000000000 4327618...
result:
wrong answer 1st numbers differ - expected: '833782882.6666666', found: '843938490.0000000', error = '0.0121802'