Skip to content

Instantly share code, notes, and snippets.

@qkreltms
Created April 15, 2018 09:34
Show Gist options
  • Select an option

  • Save qkreltms/b5ffb1cec1e2c5c9914404935faa2a39 to your computer and use it in GitHub Desktop.

Select an option

Save qkreltms/b5ffb1cec1e2c5c9914404935faa2a39 to your computer and use it in GitHub Desktop.
def f(n):
d = [0] * (n+1)
d[0] = 1
d[1] = 1
for i in range(2, n+1):
d[i] = d[i-1] + 2 * d[i-2]
d[i] %= 10007
return d[n]
print(f(int(input())))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment