[ create a new paste ] login | about

Link: http://codepad.org/UNoDl7wD    [ raw code | output | fork ]

Python, pasted on Jan 17:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
k=0
n=0
while k<6:
        n=n+1
        w=0
        for a in range(0,n/6+1):
                for b in range(0,n/9+1):
                        for c in range(0,n/20+1):
                                if 6*a+9*b+20*c == n:
                                        w=1
        if w==1:
                k=k+1
        else:
                k=0
                wanted=n
print 'the largest number of McNuggets\
that cannot be bought in exact quantity:',wanted


Output:
1
the largest number of McNuggetsthat cannot be bought in exact quantity: 43


Create a new paste based on this one


Comments: