QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#227178 | #6801. Blackjack | jzh | TL | 66ms | 14680kb | Python3 | 1.1kb | 2023-10-27 00:55:19 | 2023-10-27 00:55:20 |
Judging History
answer
import copy
maxn = 505
db = float
def solve():
n, a, b = map(int, input().split())
vec = [0] + list(map(int, input().split())) # 在vec前加一个0以保持与C++索引一致
dp = [([0.0] * (maxn)) for _ in range(maxn)]
dp[0][0] = 1.0
for i in range(1, n+1):
ndp = [([0.0] * (maxn)) for _ in range(maxn)]
for x in range(i):
for y in range(b+1):
ndp[x][y] += dp[x][y]
if y + vec[i] <= b:
ndp[x+1][y + vec[i]] += dp[x][y] * (x+1) / (n-x)
# print(ndp[0][0])
dp = [row[:] for row in ndp]
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]] -= ndp[x][y] * (x+1) / (n-x)
temp = 0.0
for x in range(n):
for y in range(a+1):
if y + vec[i] > a and y + vec[i] <= b:
temp += ndp[x][y] / (n-x)
ans += temp
print('{:.50f}'.format(ans))
solve()
详细
Test #1:
score: 100
Accepted
time: 21ms
memory: 14592kb
input:
5 2 4 1 1 1 5 5
output:
0.10000000000000000555111512312578270211815834045410
result:
ok found '0.1000000', expected '0.1000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 24ms
memory: 14544kb
input:
5 2 4 1 1 1 3 5
output:
0.45000000000000006661338147750939242541790008544922
result:
ok found '0.4500000', expected '0.4500000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 65ms
memory: 14608kb
input:
18 10 11 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
output:
0.00000000000000000000000000000000000000000000000000
result:
ok found '0.0000000', expected '-0.0000000', error '-0.0000000'
Test #4:
score: 0
Accepted
time: 53ms
memory: 14444kb
input:
14 15 16 3 3 3 3 3 3 3 3 3 3 3 3 3 3
output:
0.00000000000000000000000000000000000000000000000000
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'
Test #5:
score: 0
Accepted
time: 29ms
memory: 14512kb
input:
7 20 23 4 4 4 4 4 4 4
output:
0.00000000000000000000000000000000000000000000000000
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'
Test #6:
score: 0
Accepted
time: 38ms
memory: 14540kb
input:
10 25 27 5 5 5 5 5 5 5 5 5 5
output:
0.00000000000000000000000000000000000000000000000000
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'
Test #7:
score: 0
Accepted
time: 25ms
memory: 14516kb
input:
6 30 35 6 6 6 6 6 6
output:
0.00000000000000000000000000000000000000000000000000
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'
Test #8:
score: 0
Accepted
time: 39ms
memory: 14388kb
input:
9 35 36 7 7 7 7 7 7 7 7 7
output:
0.00000000000000000000000000000000000000000000000000
result:
ok found '0.0000000', expected '-0.0000000', error '-0.0000000'
Test #9:
score: 0
Accepted
time: 54ms
memory: 14532kb
input:
14 33 40 8 8 8 8 8 8 8 8 8 8 8 8 8 8
output:
0.99999999999999955591079014993738383054733276367188
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #10:
score: 0
Accepted
time: 34ms
memory: 14388kb
input:
7 43 45 9 9 9 9 9 9 9
output:
1.00000000000000022204460492503130808472633361816406
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #11:
score: 0
Accepted
time: 37ms
memory: 14444kb
input:
7 49 50 10 10 10 10 10 10 10
output:
1.00000000000000022204460492503130808472633361816406
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #12:
score: 0
Accepted
time: 38ms
memory: 14556kb
input:
7 49 55 11 11 11 11 11 11 11
output:
1.00000000000000022204460492503130808472633361816406
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #13:
score: 0
Accepted
time: 55ms
memory: 14588kb
input:
16 53 60 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12
output:
1.00000000000000000000000000000000000000000000000000
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #14:
score: 0
Accepted
time: 66ms
memory: 14676kb
input:
16 53 65 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13
output:
1.00000000000000000000000000000000000000000000000000
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #15:
score: 0
Accepted
time: 39ms
memory: 14600kb
input:
10 55 60 8 2 8 10 8 8 1 2 8 10
output:
0.56388888888888888395456433499930426478385925292969
result:
ok found '0.5638889', expected '0.5638889', error '0.0000000'
Test #16:
score: 0
Accepted
time: 38ms
memory: 14628kb
input:
10 38 43 5 8 1 9 7 2 1 9 3 1
output:
0.48888888888888909489693901377904694527387619018555
result:
ok found '0.4888889', expected '0.4888889', error '0.0000000'
Test #17:
score: 0
Accepted
time: 42ms
memory: 14644kb
input:
10 49 52 8 2 8 10 6 2 10 5 1 5
output:
0.38611111111111057203615359867399092763662338256836
result:
ok found '0.3861111', expected '0.3861111', error '0.0000000'
Test #18:
score: 0
Accepted
time: 42ms
memory: 14680kb
input:
10 44 49 3 10 3 2 7 5 5 10 5 4
output:
0.67777777777778047685330875538056716322898864746094
result:
ok found '0.6777778', expected '0.6777778', error '0.0000000'
Test #19:
score: 0
Accepted
time: 43ms
memory: 14564kb
input:
10 54 58 5 9 8 2 4 3 8 7 7 6
output:
0.30000000000000082156503822261583991348743438720703
result:
ok found '0.3000000', expected '0.3000000', error '0.0000000'
Test #20:
score: 0
Accepted
time: 36ms
memory: 14632kb
input:
10 46 49 2 2 3 9 9 3 4 5 7 7
output:
0.50000000000000011102230246251565404236316680908203
result:
ok found '0.5000000', expected '0.5000000', error '0.0000000'
Test #21:
score: 0
Accepted
time: 47ms
memory: 14632kb
input:
10 50 51 10 9 10 4 8 2 1 1 2 10
output:
0.05753968253968236301609806560009019449353218078613
result:
ok found '0.0575397', expected '0.0575397', error '0.0000000'
Test #22:
score: 0
Accepted
time: 38ms
memory: 14544kb
input:
10 35 39 8 6 4 1 3 1 9 6 2 3
output:
0.58888888888888957229283960259635932743549346923828
result:
ok found '0.5888889', expected '0.5888889', error '0.0000000'
Test #23:
score: 0
Accepted
time: 38ms
memory: 14576kb
input:
10 62 64 10 8 7 4 4 7 10 10 8 1
output:
0.04444444444444527186899307480416609905660152435303
result:
ok found '0.0444444', expected '0.0444444', error '0.0000000'
Test #24:
score: 0
Accepted
time: 46ms
memory: 14492kb
input:
10 40 41 2 2 2 4 6 4 4 6 5 10
output:
0.36666666666666525298268197730067186057567596435547
result:
ok found '0.3666667', expected '0.3666667', error '0.0000000'
Test #25:
score: -100
Time Limit Exceeded
input:
500 392 500 21 90 87 268 118 213 27 34 32 41 186 21 116 237 110 219 115 117 118 407 298 123 111 170 273 451 273 206 122 333 249 85 53 414 254 71 305 2 287 370 440 397 158 471 406 425 161 200 355 338 44 421 27 132 236 439 428 353 22 125 269 208 373 130 213 272 403 203 60 127 378 126 383 417 320 439 9...