QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#711443 | #8511. Greek Casino | AngelOlan | WA | 0ms | 4044kb | C++20 | 732b | 2024-11-05 11:04:13 | 2024-11-05 11:04:14 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
// Pura Gente del Coach Moy
using ld = long double;
signed main() {
cin.tie(0)->sync_with_stdio(0);
cout << setprecision(12) << fixed;
int N;
cin >> N;
vector<int> W(N + 1);
int S = 0;
for (int i = 1; i <= N; ++i) {
cin >> W[i];
S += W[i];
}
vector<int> D(N + 1);
for (int i = 1; i <= N; ++i) {
for (int j = i; j <= N; j += i) {
D[j] += W[i];
}
}
vector<ld> E(N + 1);
for (int i = N; i >= 1; --i) {
ld C = (ld)D[i] / S, inner = C;
for (int j = 2 * i; j <= N; j += i) {
inner += (1 + E[j]) * (D[j] - D[i]) / S;
}
E[i] = inner / (1 - C);
}
cout << E[1] << '\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3728kb
input:
3 1 1 1
output:
3.500000000000
result:
ok found '3.500000000', expected '3.500000000', error '0.000000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3772kb
input:
3 1 1 2
output:
3.666666666667
result:
ok found '3.666666667', expected '3.666666667', error '0.000000000'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 4044kb
input:
1337 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
6.540367357148
result:
wrong answer 1st numbers differ - expected: '1.0183368', found: '6.5403674', error = '5.4225973'