Skip to content

Instantly share code, notes, and snippets.

@ZeronSix
Created October 16, 2015 15:21
Show Gist options
  • Save ZeronSix/44be8ebd6e0d2e207f1a to your computer and use it in GitHub Desktop.
Save ZeronSix/44be8ebd6e0d2e207f1a to your computer and use it in GitHub Desktop.
1225. Флаги
#!/usr/bin/python3
def get_combination_count(i):
global arr
if arr[i - 1] == -1:
if i <= 2:
arr[i - 1] = 2
else:
arr[i - 1] = (get_combination_count(i - 2) +
get_combination_count(i - 1))
return arr[i - 1]
n = int(input())
arr = [-1] * n
print(get_combination_count(n))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment