Combination part of this round 136 C problem not making sense

Revision en2, by UnburnedZuko, 2022-10-03 05:53:33

[problem:1739C]In the problem(this one), when finding combinations(just learned them while solving this problem), we add previous values from n-2 function calling, like this
~~~~~
def calc(n):
if n == 2:
return [1, 0, 1]
a = calc(n — 2)
return [comb(n — 1, n // 2) + a[1], comb(n — 2, n // 2) + a[0], 1]#[alex win,boris win,draw]
~~~~~

but why do we add up alex's winnings on n with boris's winnings during n-2? why does adding adding 1 players winnings with his losses with less cards make sense? Would appreciate a proper explanation from anyone. And is there something I need to study up on to get this? Thanks in advance.

Tags combinations

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English UnburnedZuko 2022-10-03 05:53:33 40 Tiny change: 'calc(n):\n if n' -> 'calc(n):\n\n if n'
en1 English UnburnedZuko 2022-10-03 05:51:04 779 Initial revision (published)