19 lines
315 B
Python
19 lines
315 B
Python
|
#!/usr/bin/env python3
|
||
|
|
||
|
# Modified 115
|
||
|
|
||
|
def main(n):
|
||
|
return p(2, n) + p(3, n) + p(4, n) - 3
|
||
|
|
||
|
def p(m, n, tbl=False):
|
||
|
if n < m:
|
||
|
return 1
|
||
|
if tbl==False:
|
||
|
tbl = []
|
||
|
if n-m >= len(tbl):
|
||
|
r = p(m, n-1, tbl) + p(m, n-m, tbl)
|
||
|
tbl.append(r)
|
||
|
return tbl[n-m]
|
||
|
|
||
|
print(main(50))
|