QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#656931 | #5304. Money Game | iliyian# | WA | 1ms | 3912kb | C++23 | 1021b | 2024-10-19 13:52:56 | 2024-10-19 13:53:02 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
int qpow(int a, int b, int mod) {
int ans = 1;
while (b) {
if (b & 1) ans = ans * a % mod;
a = a * a % mod;
b >>= 1;
}
return ans;
}
void solve() {
int n;
std::cin >> n;
std::vector<int> a(n + 1);
std::vector<double> ans(n + 1);
int sum = 0;
for (int i = 1; i <= n; i++) {
std::cin >> a[i];
sum += a[i];
ans[i] = a[i];
}
for (int t = 1; t <= 10000; t++) {
int p = (t - 1) % n + 1;
ans[p % n + 1] += ans[p] / 2;
ans[p] /= 2;
}
for (int i = 1; i <= n; i++) {
std::cout << ans[i] << ' ';
}
// return;
double t = (double)sum / (n + 1);
int pos = qpow(2022, 1204, n);
pos += 2;
for (int i = 1; i <= n; i++) {
std::cout << std::fixed << std::setprecision(20) << t * (i == pos ? 2 : 1) << ' ';
}
std::cout << '\n';
}
signed main() {
std::cin.tie(nullptr)->sync_with_stdio(false);
int t = 1;
while (t--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3912kb
input:
2 4 2
output:
4 2 2.00000000000000000000 4.00000000000000000000
result:
wrong output format Extra information in the output file