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

Convertion Excel SpreadSheets into SQLITE3 Database via python on Fedora 40 WKS

  Original task proposed here   https://inf-ege.sdamgia.ru/problem?id=47000   Python script code (.env) boris@fedora40RCKDE : ~/EXCEL $ cat ...