mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2025-01-11 23:31:58 +00:00
P4550 收集邮票
R52362252
This commit is contained in:
parent
6975e0bf42
commit
6a3848036d
17
Luogu/problem/P4550/P4550.cpp
Normal file
17
Luogu/problem/P4550/P4550.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include <bits/stdc++.h>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int n;
|
||||||
|
double f[10005], g[10005];
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
cin >> n;
|
||||||
|
f[n] = g[n] = 0;
|
||||||
|
for (int i = n - 1; i >= 0; i--) {
|
||||||
|
f[i] = f[i + 1] + 1.00 * n / (n - i);
|
||||||
|
g[i] = 1.00 * i / (n - i) * (2 * f[i] + 1) + g[i + 1] + 2 * f[i + 1] + 1;
|
||||||
|
}
|
||||||
|
cout << fixed << setprecision(2) << 1.00 * (g[0] + f[0]) / 2 << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user