Submission details
Task:Arvonta
Sender:Mahtimursu
Submission time:2025-09-07 20:13:46 +0300
Language:Python3 (PyPy3)
Status:READY
Result:37
Feedback
groupverdictscore
#1ACCEPTED37
#20
Test results
testverdicttimegroup
#1ACCEPTED0.04 s1, 2details
#2--2details

Code

from math import factorial

def prob(k, n, p):
    nck = factorial(n) / (factorial(k) * factorial(n-k))

    return nck * p**k * (1-p)**(n-k)

t = int(input())

for _ in range(t):
    n = int(input())

    # x voittoa: x * 1/n * (n-x) * (n-1)/n
    ans = 0
    for x in range(1, n+1):
        ans += prob(x, n, 1/n)

    print(ans)

Test details

Test 1

Group: 1, 2

Verdict: ACCEPTED

input
10
1
2
3
4
...

correct output
1.0
0.75
0.7037037037
0.68359375
0.67232
...

user output
1.0
0.75
0.7037037037037037
0.68359375
0.6723200000000001
...
Truncated

Test 2

Group: 2

Verdict:

input
1000
1
2
3
4
...

correct output
1.0
0.75
0.7037037037
0.68359375
0.67232
...

user output
(empty)