QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#635065 | #3994. Easy Jump | dspt | WA | 0ms | 1620kb | C++23 | 1.7kb | 2024-10-12 18:55:31 | 2024-10-12 18:55:32 |
Judging History
answer
#include <stdio.h>
int b[1001]; double p[1001], f[1001][10][7], g[1001][10];
int main()
{
int n, h, s, t1, t2; scanf("%d%d%d", &n, &h, &s);
for (int i(1); i <= n; ++i) scanf("%lf", &p[i]), p[i] /= 100;
int m; scanf("%d", &m); while (m--) { int i; scanf("%d", &i); b[i] = true; }
scanf("%d%d", &t1, &t2);
if (t1 >= t2 || !s)
{
for (int i(n); i; --i)
{
g[i][2] = (t2 + 1) / p[i] + g[i + 1][2] - t2;
for (int j(3); j <= h; ++j)
g[i][j] = p[i] * g[i + 1][j] + (1 - p[i]) * g[i][j - 1] + 1;
}
printf("%.6f\n", g[1][h]);
}
else
{
for (int i(n); i; --i)
if (b[i])
{
double d[h + 1], e[h + 1]; for (int j(2); j <= h; ++j) d[j] = 1e9;
for (int c(2); c <= h; ++c)
{
e[c] = (t1 + 1) / p[i] + f[i + 1][c][s] - t1;
for (int j(c + 1); j <= h; ++j) e[j] = p[i] * f[i + 1][j][s] + (1 - p[i]) * e[j - 1] + 1;
for (int j(2); j < c; ++j) e[j] = e[c] + (c - j) * t1;
for (int j(2); j <= h; ++j) if (e[j] < d[j]) d[j] = e[j];
}
for (int j(2); j <= h; ++j) for (int k(0); k <= s; ++k) f[i][j][k] = d[j];
}
else
{
f[i][2][0] = (t2 + 1) / p[i] + f[i + 1][2][0] - t2;
for (int k(0); k <= s; ++k) f[i][2][k] = p[i] * f[i + 1][2][k] + (1 - p[i]) * (f[i][2][k - 1] + t1) + 1;
for (int j(2); j <= h; ++j) for (int k(0); k <= s; ++k)
f[i][j][k] = p[i] * f[i + 1][j][k] + (1 - p[i]) * f[i][j - 1][k];
}
printf("%.6f\n", f[1][h][s]);
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 1620kb
input:
1 2 0 50 0 1 2
output:
4.000000
result:
ok found '4.0000000', expected '4.0000000', error '0.0000000'
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 1616kb
input:
2 3 1 50 50 1 1 1 3
output:
2.500000
result:
wrong answer 1st numbers differ - expected: '6.0000000', found: '2.5000000', error = '0.5833333'