QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#227153 | #6801. Blackjack | jzh# | WA | 20ms | 14220kb | Python3 | 1.0kb | 2023-10-26 23:48:00 | 2023-10-26 23:48:02 |
Judging History
answer
maxn = 505
db = float
def solve():
n, a, b = map(int, input().split())
vec = list(map(int, input().split()))
dp = [[0.0] * (maxn) for _ in range(maxn)]
ndp = [[0.0] * (maxn) for _ in range(maxn)]
dp[0][0] = 1.0
for i in range(1, n+1):
for x in range(i+1):
for y in range(b+1):
ndp[x][y] += dp[x][y]
if y + vec[i-1] <= b:
ndp[x+1][y + vec[i-1]] += dp[x][y] * (x+1) / (n-x)
for x in range(maxn):
dp[x] = ndp[x][:]
ans = 0.0
for i in range(1, n+1):
ndp = [row[:] for row in dp]
for x in range(n):
for y in range(b+1):
ndp[x+1][y+vec[i-1]] -= ndp[x][y] * (x+1) / (n-x)
temp = 0.0
for x in range(n-1):
for y in range(a, b+1):
if y + vec[i-1] > a and y + vec[i-1] <= b:
temp += ndp[x][y] / (n-x)
ans += temp
print('{:.50f}'.format(ans))
solve()
详细
Test #1:
score: 0
Wrong Answer
time: 20ms
memory: 14220kb
input:
5 2 4 1 1 1 5 5
output:
0.40000000000000013322676295501878485083580017089844
result:
wrong answer 1st numbers differ - expected: '0.1000000', found: '0.4000000', error = '0.3000000'