Advertisement
Korotkodul

N23_6544

Jun 12th, 2023
662
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. dp1 = [0] * (10**4 + 10)
  2. dp2 = [0] * (10**4 + 10)
  3. dp1[1] = 1
  4. dp2[1] = 1
  5. #dp1,dp2
  6. #20min
  7. for i in range(2,10**4+10):
  8.     s1 = 0
  9.     s2 = 0
  10.     if i - 3 >= 1:
  11.         s1 += dp1[i - 3]
  12.         s2 += dp2[i - 3]
  13.     if i - 5 >= 1:
  14.         s1 += dp1[i - 5]
  15.         s2 += dp2[i - 5]
  16.     if i % 2 == 0:
  17.         s1 += dp1[i // 2]
  18.         s2 += dp2[i // 2]
  19.     if i == 5000:
  20.         s1 = 0
  21.     if i == 3000:
  22.         s2 = 0
  23.     dp1[i] = s1
  24.     dp2[i] = s2
  25. ans = dp1[10**4] + dp2[10**4]
  26. #print(ans)
  27. s = str(ans)
  28. print(s[-6:])
  29.  
  30.        
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement