from math import ceil
t=int(input())
for p in range(1,t+1):
    n,d=map(int,input().split())
    a=list(map(int,input().split()))
    minn=0
    i=0
    j=0
    for y in a:
        b=(d//y)*y
        if(i!=0):
            if(minn>b):
                mi=m-(a[j]*ceil((m-b)/a[j]))
                if(minn>mi):
                    minn=mi
            j+=1
        else:
            minn=b    
        m=b
        i+=1
    print("Case #{}: {}".format(p,minn))
Whats wrong in my code??
my results are wrong answer and test set skipped
the code is working good on sample test.
please help me to find out the mistake.
note - Im just a beginner

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/594922b0-e1d8-4a1f-8fb6-da1f3524bce0%40googlegroups.com.

Reply via email to