Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 9 Online
OpenStudy (anonymous):

Hey, I just started problem set 2, problem 1 and I need a bit of help... Can anyone explain to me the second part of problem 1? This is what I have so far: http://dpaste.com/575035/

OpenStudy (anonymous):

You have a working solution to find for any given number of nuggets if the combination is possible and if so the number of 6,9, and 20 packs to make the combination. Above some number of nuggets, it is possible to make a combination with 6,9. and 20 for any number. Is that number 200? 500? You need to find the number. One way to do so would be to test a sequence of numbers, and when you get a certain number of "Trues" in a row to decide that from then on each number that follows will have a possible combination. A bit arbitrary but it works.

OpenStudy (anonymous):

***not sure that was clear...it didn't seem very clear when I read it... After a certain number and for every number from then on it is possible to make the number with a combination of 6,9 and 20. What is that certain number?

OpenStudy (anonymous):

Gotcha... thanks for the explanation. Ok, so here is what I have for ps2a: http://dpaste.com/575109/ ... I think I did it right... any suggestions/criticisms?

OpenStudy (anonymous):

it works. picking the limit for your while loop (line 18/26) is crucial, if the answer had been greater than 100 would it have worked?

OpenStudy (anonymous):

I actually tested up to 1000 and got the same results. I just put in 100 because I pretty much new that once I hit the 50s my mcnuggets program would find a combination that would return True.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!