Showing posts with label Integer Sequences from Addition of Terms solution. Show all posts
Showing posts with label Integer Sequences from Addition of Terms solution. Show all posts

Saturday, 20 April 2019

Uva Online Judge - 927 Integer Sequences from Addition of Terms - Solution in Python

solution:
n=int(input())
for i in range(1,n+1):
    st=input()
    c=[int(s) for s in st.split(" ")]
    d=int(input())
    k=int(input())
    (sum,n)=(0,1)
    an=0
    while(True):
        sum+=n*d
        if(sum>=k):
            for j in range(1,len(c)):
                an+=c[j]*(n**(j-1))
            print(an)
            break
        n+=1

This post is contributed by 
G. Rama Krishna Srinivas, M.Tech
Asst.Prof, KLUniversity.