QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#227153#6801. Blackjackjzh#WA 20ms14220kbPython31.0kb2023-10-26 23:48:002023-10-26 23:48:02

Judging History

你现在查看的是最新测评结果

  • [2023-10-26 23:48:02]
  • 评测
  • 测评结果:WA
  • 用时:20ms
  • 内存:14220kb
  • [2023-10-26 23:48:00]
  • 提交

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'