fork(1) download
  1. n = 20
  2. s = 1
  3.  
  4. a = [0] * (n+1)
  5. a[s] = 1
  6.  
  7. for i,x in enumerate(a):
  8. if i+1 <= n: a[i+1] += x
  9. if i+2 <= n: a[i+2] += x
  10. if i+i <= n: a[i+i] += x
  11.  
  12. print(a[n])
Success #stdin #stdout 0.03s 9132KB
stdin
Standard input is empty
stdout
20174