QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#748404#5304. Money Gamezaqmju#WA 0ms3772kbC++23839b2024-11-14 20:18:362024-11-14 20:18:36

Judging History

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

  • [2024-11-14 20:18:36]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3772kb
  • [2024-11-14 20:18:36]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define LF(x) fixed << setprecision(x)
void solve() {
	int n; cin >> n;
	vector<long double>a(n);
	map<vector<long double>, bool>mp;
	for(auto &i:a)cin >> i;
	vector<long double>b = a;
	auto cal = [&](vector<long double> &v) -> void{
		for(int i = 0; i < n - 1; i++){
			v[i + 1] += v[i] / 2;
			v[i] /= 2;
		}
		v[0] += v[n - 1] / 2;
		v[n - 1] /= 2;
	};
	mp[a] = 1;
	cal(b);
	while(!mp[b]){
		// cnt++;
		cal(b);
		mp[b] = 1;
		// 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;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
4 2

output:

4.0000000000 2.0000000000 

result:

ok 2 numbers

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3772kb

input:

2
2 3

output:

3.2500000000 1.7500000000 

result:

wrong answer 1st numbers differ - expected: '3.3333333', found: '3.2500000', error = '0.0250000'