Project Euler #31: Coin sums

  • + 0 comments

    Lovely challenge, 100/- points python3

    no=10**5
    multiples=[1,2,5,10,20,50,100,200,]
    lis=[]
    for i in range(no+1):
        lis.append(i//2+1) #it reduced my time efficiency by 3 times in my earlier code which was slower
    
    for i in multiples[2:]:
        for n in range(no-i+1):
            lis[n+i]+=lis[n]
            
    for _ in range(int(input())):
        n=int(input())
        print(lis[n]%(10**9+7))