Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def input_polynom():
- k = int(input("кол-во членов в многочлене: "))
- mas = []
- for i in range(k):
- mas.append(int(input(f"a[{i}] = ")))
- return mas
- def multiply(a, b):
- c = [0.0]*(len(a) + len(b)-1)
- for i in range(len(a)):
- for j in range(len(b)):
- c[i + j] += a[i] * b[j]
- return c
- def pow(a, n):
- c = [1]
- for i in range(n):
- c = multiply(c, a)
- return c
- A = input_polynom()
- k = int(input("Степень: "))
- A.reverse()
- print(pow(A, k))
- input()
Advertisement
Add Comment
Please, Sign In to add comment