Why am i getting a difference of 1 for n=60 ? codeforces educational round 136 (C-CARD GAME)?

Revision en1, by zerodedication, 2022-09-30 10:29:52

I tried to solve the problem but am getting 341102826 248150917 1 this answer for n=60 Clearly it is having one more than the expected answer for boris ! Attaching my code below ! NEED HELP

# cook your dish here
import math

mod = 998244353
def calc(n , r): 
    num = math.factorial(n)
    den = math.factorial(r)*math.factorial(n-r)
    return (num/den)
    
dp=[]
t = int(input())
for i in range(70):
    dp.append([0,0])
dp[2][0] = 1 
dp[2][1]=  0 
for i in range(4,70,2): 
    temp = i//2
    half = math.factorial(i-1)//(math.factorial(temp-1)*math.factorial(i-temp))
    dp[i][0] = dp[i-2][1]+half
    dp[i][1]=calc(i,i//2)-dp[i][0]-1

for test in range(0 , t) : 
    n = int(input())
    print(int(dp[n][0])%mod,int(dp[n][1])%mod,1)

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English zerodedication 2022-09-30 10:29:52 889 Initial revision (published)