Skip to content

Instantly share code, notes, and snippets.

@varundey
Last active July 5, 2016 15:52
Show Gist options
  • Save varundey/62f4276b9763647bf3d5114262d4ba9c to your computer and use it in GitHub Desktop.
Save varundey/62f4276b9763647bf3d5114262d4ba9c to your computer and use it in GitHub Desktop.
def value(k, degree, coefficients):
ans = 0
for i in range(degree+1):
ans += coefficients[i]*pow(k,i)
return ans
degree = input()
coefficients = map(int,raw_input().split())
t=input()
while t!=0:
t-=1
print value(input(), degree, coefficients)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment