If you add 6 to those totals, you get 56,57,58,59,60,61. If you add 6 to those totals, you get 62,63,64,65,66,67.
Problem 2:
So basically, once the condition is true for any run of six, it's true for that run of six + 6, which works out to every number greater than the start of the first run of six. If it were true for a run of nine, it would also be true for that run of nine + 9, etc.
Your other code allowed James T. Kirk to get laid. It us CRUCIALLY IMPORTANT!
As for this one, I had no problem with questions 1 & 2, stumbled into a nice solution for the original McNugget problem that solved it with math rather than exhaustive search, and then faceplanted in problem 4 because I'm pretty sure that assignment 2 isn't supposed to be NP-hard, even at MIT. I... need to step away from it and find some other practice problem with the same logical structure. Sigh.
I got a little intimidated looking at the problem set, because it's been a loooong time since I took math, but it really is mostly "can you loop through stuff until you come up with an answer?"
Yep. I tend to get stuck on "but what's the solution?" rather than "what am I practicing here?"
So with that in mind, I'm off to play with possible combinations of Hardison, Eliot, and Parker; they're better than McNuggets in so many ways. Thanks for posting your solution - it was a good clarifier when I was letting things get too complicated.
no subject
Date: 2009-11-19 12:10 am (UTC)Problem 1:
6a,9b,20c = n
2,2,1 = 50
1,5,0 = 51
2,0,2 = 52
1,3,1 = 53
0,6,0 = 54
1,1,2 = 55
If you add 6 to those totals, you get 56,57,58,59,60,61.
If you add 6 to those totals, you get 62,63,64,65,66,67.
Problem 2:
So basically, once the condition is true for any run of six, it's true for that run of six + 6, which works out to every number greater than the start of the first run of six. If it were true for a run of nine, it would also be true for that run of nine + 9, etc.
no subject
Date: 2009-11-19 02:25 am (UTC)As for this one, I had no problem with questions 1 & 2, stumbled into a nice solution for the original McNugget problem that solved it with math rather than exhaustive search, and then faceplanted in problem 4 because I'm pretty sure that assignment 2 isn't supposed to be NP-hard, even at MIT. I... need to step away from it and find some other practice problem with the same logical structure. Sigh.
no subject
Date: 2009-11-19 02:44 am (UTC)I got a little intimidated looking at the problem set, because it's been a loooong time since I took math, but it really is mostly "can you loop through stuff until you come up with an answer?"
no subject
Date: 2009-11-19 02:55 am (UTC)So with that in mind, I'm off to play with possible combinations of Hardison, Eliot, and Parker; they're better than McNuggets in so many ways. Thanks for posting your solution - it was a good clarifier when I was letting things get too complicated.