Submission #34395072


Source Code Expand

n = int(input())

dp = [0] * (n+10000)
dp[1] = 3.5
dp[2] = 4.25

for i in range(3, n+1) :
    key = int(dp[i-1] )
    ##print(key, i )
    _a = (sum(range(key+1,7)) / (6-key)) * ( 6 - key ) / 6 + (key/6) * dp[i-1]
    _b = (sum(range(key,7)) / (6-key+1)) * ( 6 - key + 1 ) / 6 + ((key-1)/6) * dp[i-1]
    dp[i] = max(_a, _b) 
print(dp[n])

Submission Info

Submission Time
Task E - Throwing the Die
User ay24h
Language PyPy3 (7.3.0)
Score 500
Code Size 352 Byte
Status AC
Exec Time 62 ms
Memory 62164 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 3
AC × 25
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
random_01.txt AC 62 ms 61972 KiB
random_02.txt AC 53 ms 61784 KiB
random_03.txt AC 52 ms 61840 KiB
random_04.txt AC 53 ms 61744 KiB
random_05.txt AC 53 ms 62036 KiB
random_06.txt AC 50 ms 61800 KiB
random_07.txt AC 50 ms 61508 KiB
random_08.txt AC 51 ms 61892 KiB
random_09.txt AC 53 ms 61916 KiB
random_10.txt AC 51 ms 61716 KiB
random_11.txt AC 51 ms 61760 KiB
random_12.txt AC 51 ms 61936 KiB
random_13.txt AC 52 ms 61968 KiB
random_14.txt AC 52 ms 61632 KiB
random_15.txt AC 51 ms 62164 KiB
random_16.txt AC 51 ms 61892 KiB
random_17.txt AC 51 ms 61668 KiB
random_18.txt AC 51 ms 61892 KiB
random_19.txt AC 54 ms 62056 KiB
random_20.txt AC 50 ms 62060 KiB
random_21.txt AC 50 ms 62072 KiB
random_22.txt AC 51 ms 61692 KiB
sample_01.txt AC 51 ms 61824 KiB
sample_02.txt AC 53 ms 61808 KiB
sample_03.txt AC 52 ms 61996 KiB