QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#647650#8242. V-Diagramtravel#WA 0ms3780kbC++14981b2024-10-17 15:05:552024-10-17 15:05:56

Judging History

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

  • [2024-10-17 15:05:56]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3780kb
  • [2024-10-17 15:05:55]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> PII;
#define endl "\n"
#define ft first
#define sd second
#define pb push_back
const int mod = 1e9 + 7,N = 3e5 + 10;
int a[N],n;
void solve() {
	cin>>n;
	double ans = 0.0;
	int mx = 2e18,sum = 0;
	for(int i = 1; i <= n; i++) {
		cin>>a[i];
		mx = min(mx,a[i]);
		sum +=a[i];
	}
	int t = -1;
	for(int i = 1; i <= n; i++) {
		if(a[i] == mx)
		{
			t = i;
			break;
		}
	}
	int sum1 = 0,sum2 = 0;
	for(int i = 1;i <= t + 1;i++)
		sum1 +=a[i];
	for(int i = t - 1;i <= n;i++)
		sum2 +=a[i];
//	cout<<sum<<' '<<sum1<<' '<<sum2<<endl;
	ans = sum * 1.0 / n;
//	cout<<sum1 * 1.0 / (t + 1)<<' '<<sum2 * 1.0 / (n - t + 2)<<sum * 1.0 / n<<endl;
	ans = max(ans,max(sum1 * 1.0 / (t + 1),sum2 * 1.0 / (n - t + 2)));
	printf("%.20lf",ans);
	return ;
}
signed main() {
	int T ;
	cin>>T;
	while(T--)
		solve();
	return 0;
}
/*
2
4
8 2 7 10
6
9 6 5 3 4 8
*/

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3780kb

input:

2
4
8 2 7 10
6
9 6 5 3 4 8

output:

6.750000000000000000005.83333333333333303727

result:

wrong output format Expected double, but "6.750000000000000000005.83333333333333303727" found