QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#748474#5304. Money Gamezaqmju#TL 0ms0kbC++23886b2024-11-14 20:29:342024-11-14 20:29:40

Judging History

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

  • [2024-11-14 20:29:40]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2024-11-14 20:29:34]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define LF(x) fixed << setprecision(x)
const int N = 1e8 + 8e7 + 3e6;
void solve() {
	int n; cin >> n;
	vector<int>a(n);
	int m = N / n;
	for(auto &i:a)cin >> i;
	vector<long double> b(n);
	for(int i = 0; i < n; i++)b[i] = 1.0 * a[i];
	auto cal = [&](vector<long double> &v) -> void{
		for(int i = 0; i < n - 1; i++){
			v[i + 1] += v[i] / 2.0;
			v[i] /= 2.0;
		}
		v[0] += v[n - 1] / 2.0;
		v[n - 1] /= 2.0;
	};
	int cnt = 1;
	cal(b);
	while(cnt < m){
		cnt++;
		cal(b);
		// for(auto i:b)cout << i <<' ';
		// cout <<endl;
	}
	// cout << cnt << endl;
	for(int i = 0; i < n; i++) {
		cout << LF(10) << b[i] << " ";
	}
	// cout << endl;
}

#undef int
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t = 1;
	// cin >> t;
	while(t--) {
		solve();
	}
	return 0;
}

詳細信息

Test #1:

score: 0
Time Limit Exceeded

input:

2
4 2

output:

4.0000000000 2.0000000000 

result: