fork download
  1. def f(n, table):
  2. if table[n] != -1: return table[n]
  3. table[n] = (f(n-1, table) + f(n-2, table) + f(n-3, table) + f(n-4, table))*2
  4. return table[n]
  5.  
  6. solutions = [0, 5, 10, 30] + [-1] * 500
  7. n = 100 # plug any number (n) here
  8. print( f(n, solutions) )
Success #stdin #stdout 0.03s 9176KB
stdin
Standard input is empty
stdout
253188519541244794408280713615681810329753354240