QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#694798#8242. V-DiagramxinlengweishangWA 66ms3956kbC++20682b2024-10-31 18:40:502024-10-31 18:40:56

Judging History

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

  • [2024-10-31 18:40:56]
  • 评测
  • 测评结果:WA
  • 用时:66ms
  • 内存:3956kb
  • [2024-10-31 18:40:50]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int a[1000010];
void slove(){
	ll n;
	scanf("%lld",&n);
	double ans=0;
	ll site=0,temp=1;
	for(int i=1;i<=n;i++){
		scanf("%lld",&a[i]);
		if(temp&&a[i]>a[i-1]){
			temp=0;
			site=i;
		}
		ans+=a[i];
	}
	if(a[1]*n<ans){
		for(int i=1;i<site-1;i++){
			ans-=a[i];
		}
		printf("%.10lf\n",ans/(n-site+2));
	}
	else if(a[n]*n<ans){
		for(int i=n;i>site+1;i--){
			ans-=a[i];
		}
		printf("%.10lf\n",ans/(site+1));
	}
	else{
		printf("%.10lf\n",ans/n);
	}
	return ;
}
int main(){
	int T=1;
	scanf("%d",&T);
	while(T--) slove();
	return 0;
}
/*
2
4
8 2 7 10
6
9 6 5 3 4 8
*/

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3888kb

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: 66ms
memory: 3956kb

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'