QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#220611 | #2430. Gem Island | linnyx | AC ✓ | 115ms | 40372kb | C++14 | 1.2kb | 2023-10-20 16:28:27 | 2023-10-20 16:28:27 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int, int>
#define fr first
#define sc second
inline int rd() {
int f = 1, tmp = 0;
char ch = getchar();
while (!isdigit(ch)) {
if (ch == '-')
f = -1;
ch = getchar();
}
while (isdigit(ch)) {
tmp = tmp * 10 + (ch - '0');
ch = getchar();
}
return tmp * f;
}
const int N = 5100;
double f[N][N], C[N][N], g[N][N];
int n, d, r;
signed main() {
n = rd();
d = rd();
r = rd();
C[0][0] = 1;
for (int i = 1; i <= n; i++) {
C[i][0] = 1;
for (int j = 1; j <= i; j++) {
C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
}
}
f[0][n] = 1;
for (int i = 0; i < d; i++) {
for (int j = 1; j <= n; j++) {
for (int k = 1; k <= j; k++) {
f[i + k][k] += f[i][j] * C[j][k];
g[i + k][k] += (g[i][j] + f[i][j] * min(k, r)) * C[j][k];
}
}
}
double ans1 = 0, ans2 = 0;
for (int i = 1; i <= n; i++) {
ans1 += g[d][i];
ans2 += f[d][i];
}
printf("%.6lf", ans1 / ans2 + r);
return 0;
}
Details
Test #1:
score: 100
Accepted
time: 1ms
memory: 7960kb
Test #2:
score: 0
Accepted
time: 1ms
memory: 7880kb
Test #3:
score: 0
Accepted
time: 1ms
memory: 7984kb
Test #4:
score: 0
Accepted
time: 1ms
memory: 7944kb
Test #5:
score: 0
Accepted
time: 1ms
memory: 7964kb
Test #6:
score: 0
Accepted
time: 1ms
memory: 8056kb
Test #7:
score: 0
Accepted
time: 1ms
memory: 8612kb
Test #8:
score: 0
Accepted
time: 0ms
memory: 11456kb
Test #9:
score: 0
Accepted
time: 3ms
memory: 11812kb
Test #10:
score: 0
Accepted
time: 0ms
memory: 11912kb
Test #11:
score: 0
Accepted
time: 1ms
memory: 8024kb
Test #12:
score: 0
Accepted
time: 0ms
memory: 8008kb
Test #13:
score: 0
Accepted
time: 0ms
memory: 8012kb
Test #14:
score: 0
Accepted
time: 0ms
memory: 8068kb
Test #15:
score: 0
Accepted
time: 1ms
memory: 8092kb
Test #16:
score: 0
Accepted
time: 1ms
memory: 8064kb
Test #17:
score: 0
Accepted
time: 1ms
memory: 8724kb
Test #18:
score: 0
Accepted
time: 1ms
memory: 8528kb
Test #19:
score: 0
Accepted
time: 2ms
memory: 10088kb
Test #20:
score: 0
Accepted
time: 3ms
memory: 12020kb
Test #21:
score: 0
Accepted
time: 3ms
memory: 12020kb
Test #22:
score: 0
Accepted
time: 1ms
memory: 7908kb
Test #23:
score: 0
Accepted
time: 1ms
memory: 8012kb
Test #24:
score: 0
Accepted
time: 1ms
memory: 8000kb
Test #25:
score: 0
Accepted
time: 1ms
memory: 8052kb
Test #26:
score: 0
Accepted
time: 1ms
memory: 8452kb
Test #27:
score: 0
Accepted
time: 1ms
memory: 8568kb
Test #28:
score: 0
Accepted
time: 1ms
memory: 9136kb
Test #29:
score: 0
Accepted
time: 1ms
memory: 7960kb
Test #30:
score: 0
Accepted
time: 1ms
memory: 7972kb
Test #31:
score: 0
Accepted
time: 1ms
memory: 8036kb
Test #32:
score: 0
Accepted
time: 1ms
memory: 7992kb
Test #33:
score: 0
Accepted
time: 1ms
memory: 8040kb
Test #34:
score: 0
Accepted
time: 0ms
memory: 7928kb
Test #35:
score: 0
Accepted
time: 0ms
memory: 8384kb
Test #36:
score: 0
Accepted
time: 0ms
memory: 8348kb
Test #37:
score: 0
Accepted
time: 1ms
memory: 8264kb
Test #38:
score: 0
Accepted
time: 0ms
memory: 8728kb
Test #39:
score: 0
Accepted
time: 0ms
memory: 8112kb
Test #40:
score: 0
Accepted
time: 0ms
memory: 8072kb
Test #41:
score: 0
Accepted
time: 0ms
memory: 8352kb
Test #42:
score: 0
Accepted
time: 0ms
memory: 8396kb
Test #43:
score: 0
Accepted
time: 0ms
memory: 12032kb
Test #44:
score: 0
Accepted
time: 1ms
memory: 8004kb
Test #45:
score: 0
Accepted
time: 0ms
memory: 8128kb
Test #46:
score: 0
Accepted
time: 1ms
memory: 10116kb
Test #47:
score: 0
Accepted
time: 1ms
memory: 10316kb
Test #48:
score: 0
Accepted
time: 0ms
memory: 8324kb
Test #49:
score: 0
Accepted
time: 3ms
memory: 12012kb
Test #50:
score: 0
Accepted
time: 3ms
memory: 11992kb
Test #51:
score: 0
Accepted
time: 3ms
memory: 12120kb
Test #52:
score: 0
Accepted
time: 2ms
memory: 11932kb
Test #53:
score: 0
Accepted
time: 0ms
memory: 10808kb
Test #54:
score: 0
Accepted
time: 0ms
memory: 14840kb
Test #55:
score: 0
Accepted
time: 4ms
memory: 14488kb
Test #56:
score: 0
Accepted
time: 2ms
memory: 13316kb
Test #57:
score: 0
Accepted
time: 2ms
memory: 12704kb
Test #58:
score: 0
Accepted
time: 0ms
memory: 12712kb
Test #59:
score: 0
Accepted
time: 3ms
memory: 13736kb
Test #60:
score: 0
Accepted
time: 0ms
memory: 13612kb
Test #61:
score: 0
Accepted
time: 3ms
memory: 17784kb
Test #62:
score: 0
Accepted
time: 0ms
memory: 17436kb
Test #63:
score: 0
Accepted
time: 3ms
memory: 18120kb
Test #64:
score: 0
Accepted
time: 3ms
memory: 20744kb
Test #65:
score: 0
Accepted
time: 28ms
memory: 26108kb
Test #66:
score: 0
Accepted
time: 7ms
memory: 23900kb
Test #67:
score: 0
Accepted
time: 3ms
memory: 25836kb
Test #68:
score: 0
Accepted
time: 4ms
memory: 27848kb
Test #69:
score: 0
Accepted
time: 0ms
memory: 30016kb
Test #70:
score: 0
Accepted
time: 86ms
memory: 37292kb
Test #71:
score: 0
Accepted
time: 96ms
memory: 40176kb
Test #72:
score: 0
Accepted
time: 106ms
memory: 40356kb
Test #73:
score: 0
Accepted
time: 4ms
memory: 32400kb
Test #74:
score: 0
Accepted
time: 3ms
memory: 30328kb
Test #75:
score: 0
Accepted
time: 3ms
memory: 32488kb
Test #76:
score: 0
Accepted
time: 23ms
memory: 31768kb
Test #77:
score: 0
Accepted
time: 31ms
memory: 32240kb
Test #78:
score: 0
Accepted
time: 23ms
memory: 34440kb
Test #79:
score: 0
Accepted
time: 28ms
memory: 34436kb
Test #80:
score: 0
Accepted
time: 69ms
memory: 37728kb
Test #81:
score: 0
Accepted
time: 115ms
memory: 40280kb
Test #82:
score: 0
Accepted
time: 105ms
memory: 40244kb
Test #83:
score: 0
Accepted
time: 113ms
memory: 40372kb
Test #84:
score: 0
Accepted
time: 110ms
memory: 40252kb