QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#220609 | #2430. Gem Island | linnyx | RE | 2ms | 10064kb | C++14 | 1.2kb | 2023-10-20 16:27:35 | 2023-10-20 16:27:35 |
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 = 510;
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;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 8080kb
Test #2:
score: 0
Accepted
time: 1ms
memory: 5876kb
Test #3:
score: 0
Accepted
time: 1ms
memory: 7948kb
Test #4:
score: 0
Accepted
time: 1ms
memory: 8008kb
Test #5:
score: 0
Accepted
time: 0ms
memory: 8084kb
Test #6:
score: 0
Accepted
time: 0ms
memory: 7992kb
Test #7:
score: 0
Accepted
time: 0ms
memory: 8352kb
Test #8:
score: 0
Accepted
time: 0ms
memory: 9632kb
Test #9:
score: 0
Accepted
time: 0ms
memory: 9964kb
Test #10:
score: 0
Accepted
time: 2ms
memory: 9972kb
Test #11:
score: 0
Accepted
time: 1ms
memory: 8072kb
Test #12:
score: 0
Accepted
time: 1ms
memory: 8080kb
Test #13:
score: 0
Accepted
time: 1ms
memory: 8084kb
Test #14:
score: 0
Accepted
time: 1ms
memory: 8072kb
Test #15:
score: 0
Accepted
time: 1ms
memory: 7980kb
Test #16:
score: 0
Accepted
time: 1ms
memory: 7936kb
Test #17:
score: 0
Accepted
time: 1ms
memory: 8476kb
Test #18:
score: 0
Accepted
time: 1ms
memory: 8408kb
Test #19:
score: 0
Accepted
time: 1ms
memory: 9176kb
Test #20:
score: 0
Accepted
time: 0ms
memory: 9976kb
Test #21:
score: 0
Accepted
time: 0ms
memory: 9972kb
Test #22:
score: 0
Accepted
time: 0ms
memory: 7972kb
Test #23:
score: 0
Accepted
time: 1ms
memory: 7972kb
Test #24:
score: 0
Accepted
time: 0ms
memory: 8044kb
Test #25:
score: 0
Accepted
time: 1ms
memory: 8100kb
Test #26:
score: 0
Accepted
time: 0ms
memory: 8312kb
Test #27:
score: 0
Accepted
time: 1ms
memory: 8412kb
Test #28:
score: 0
Accepted
time: 1ms
memory: 8500kb
Test #29:
score: 0
Accepted
time: 1ms
memory: 7972kb
Test #30:
score: 0
Accepted
time: 1ms
memory: 8024kb
Test #31:
score: 0
Accepted
time: 1ms
memory: 8004kb
Test #32:
score: 0
Accepted
time: 1ms
memory: 7972kb
Test #33:
score: 0
Accepted
time: 1ms
memory: 8056kb
Test #34:
score: 0
Accepted
time: 1ms
memory: 8048kb
Test #35:
score: 0
Accepted
time: 1ms
memory: 8256kb
Test #36:
score: 0
Accepted
time: 1ms
memory: 8128kb
Test #37:
score: 0
Accepted
time: 1ms
memory: 8168kb
Test #38:
score: 0
Accepted
time: 1ms
memory: 8420kb
Test #39:
score: 0
Accepted
time: 1ms
memory: 7992kb
Test #40:
score: 0
Accepted
time: 0ms
memory: 8104kb
Test #41:
score: 0
Accepted
time: 0ms
memory: 8180kb
Test #42:
score: 0
Accepted
time: 0ms
memory: 8248kb
Test #43:
score: 0
Accepted
time: 2ms
memory: 9972kb
Test #44:
score: 0
Accepted
time: 1ms
memory: 8012kb
Test #45:
score: 0
Accepted
time: 1ms
memory: 8064kb
Test #46:
score: 0
Accepted
time: 1ms
memory: 8056kb
Test #47:
score: 0
Accepted
time: 1ms
memory: 8244kb
Test #48:
score: 0
Accepted
time: 1ms
memory: 8200kb
Test #49:
score: 0
Accepted
time: 2ms
memory: 10064kb
Test #50:
score: 0
Accepted
time: 2ms
memory: 10056kb
Test #51:
score: 0
Accepted
time: 2ms
memory: 10000kb
Test #52:
score: 0
Accepted
time: 2ms
memory: 8868kb
Test #53:
score: 0
Accepted
time: 1ms
memory: 8388kb
Test #54:
score: -100
Runtime Error