Advertisement
nq1s788

23 с изб и с огр

Jan 6th, 2024
693
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. #обязательно 10 и 21, избегаемые 5 и 17
  2. a = [0] * 31
  3. a[1] = 1
  4. for i in range(2, 11):
  5.     if i == 5:
  6.         continue
  7.     a[i] += a[i - 1]
  8.     if i % 2 == 0:
  9.         a[i] += a[i // 2]
  10. for i in range(11, 22):
  11.     if i == 17:
  12.         continue
  13.     a[i] += a[i - 1]
  14.     if i % 2 == 0 and i // 2 >= 10:
  15.         a[i] += a[i // 2]
  16. for i in range(22, 31):
  17.     a[i] += a[i - 1]
  18.     if i % 2 == 0 and i // 2 >= 21:
  19.         a[i] += a[i // 2]
  20. print(a[30])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement