QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#748353 | #5304. Money Game | zaqmju# | WA | 1ms | 3920kb | C++23 | 734b | 2024-11-14 20:08:31 | 2024-11-14 20:08:31 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve() {
int n; cin >> n;
vector<double>a(n);
for(auto &i:a)cin >> i;
vector<double>b = a;
auto cal = [&](vector<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 < 1000){
cnt++;
cal(b);
// for(auto i:b)cout << i <<' ';
// cout <<endl;
}
// cout << cnt << endl;
for(int i = 0; i < n; i++)printf("%.8lf ", 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: 3764kb
input:
2 4 2
output:
4.00000000 2.00000000
result:
ok 2 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
2 2 3
output:
3.33333333 1.66666667
result:
ok 2 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 3884kb
input:
2 851648 722281
output:
1049286.00000000 524643.00000000
result:
ok 2 numbers
Test #4:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
3 450762 114467 367746
output:
466487.50000000 233243.75000000 233243.75000000
result:
ok 3 numbers
Test #5:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
4 2 3 5 1
output:
4.40000000 2.20000000 2.20000000 2.20000000
result:
ok 4 numbers
Test #6:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
5 616288 155735 783782 648639 349827
output:
851423.66666667 425711.83333333 425711.83333333 425711.83333333 425711.83333333
result:
ok 5 numbers
Test #7:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
6 1 2 5 5 1 2
output:
4.57142857 2.28571429 2.28571429 2.28571429 2.28571429 2.28571429
result:
ok 6 numbers
Test #8:
score: -100
Wrong Answer
time: 1ms
memory: 3704kb
input:
100 283397 377774 494372 487546 143741 314831 934818 229251 78798 395137 407818 18761 516178 734330 838264 433107 858247 174903 905002 445936 58127 253493 844807 215023 37167 11961 885588 176935 156947 82314 21120 373809 226377 712113 302554 613417 368577 604224 811349 182256 179860 424904 544075 16...
output:
847315.02846461 423509.98003986 423442.82598950 423379.52317536 423320.31622280 423265.43389341 423215.08820106 423169.47359283 423128.76619787 423093.12314723 423062.68196722 423037.56004865 423017.85419395 423003.64024407 422994.97278643 422991.88494511 422994.38825417 423002.47261441 423016.10633...
result:
wrong answer 1st numbers differ - expected: '848873.9009901', found: '847315.0284646', error = '0.0018364'