QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#748319 | #5304. Money Game | zaqmju# | WA | 0ms | 4096kb | C++23 | 770b | 2024-11-14 20:01:55 | 2024-11-14 20:01:55 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve() {
int n; cin >> n;
vector<double>a(n);
map<vector<double>, bool>mp;
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;
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++)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;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3744kb
input:
2 4 2
output:
4.00000000 2.00000000
result:
ok 2 numbers
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 4096kb
input:
2 2 3
output:
3.25000000 1.75000000
result:
wrong answer 1st numbers differ - expected: '3.3333333', found: '3.2500000', error = '0.0250000'