Friday, 24 September 2021

 The executor has three commands, which are assigned numbers:

1) Add 2  2) Add previous 3) Add the following

The first command increases the number by 2, the second - by the previous one (for example,the number 5 will be converted according to the rule 5 + 4), the third - to the next (similarly, 5 according to the rule 5 + 6 = 11).How many programs are there that the original number is 7 is converted to the number 63, while the computation path does not contain the number 43?


$ cat task23.py

a =[0]*130
a[7] =1

for i in range(7,43):
    a[i+2] += a[i]
    a[i + (i - 1)] += a[i]
    a[i + (i + 1)] += a[i]

for i in range(44,63):
    a[i+2] += a[i]
    a[i + (i - 1)] += a[i]
    a[i + (i + 1)] += a[i]

print(a[63])

$ python  task23.py
116
















No comments:

Post a Comment

Задание 2 // КЕГЭ по информатике 2024 Стрим Алексея Кабанова

  Смотри https://www.youtube.com/watch?v=Af_U6uXnBAU