QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#740579#8242. V-DiagramHHSWA 102ms4068kbC++14708b2024-11-13 10:36:462024-11-13 10:36:46

Judging History

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

  • [2024-11-13 10:36:46]
  • 评测
  • 测评结果:WA
  • 用时:102ms
  • 内存:4068kb
  • [2024-11-13 10:36:46]
  • 提交

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();
}

Details

Tip: Click on the bar to expand more detailed information

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'