Hi guys.
So here's the story, I'm trying to solve this problem with a python script. (I feel like I'm advertising, I've already posted links to Euler three times now)
So here's my brute-force, inefficient script:
I've ran in once, and it wasn't the right answer, but the script should be right. I've checked with printing all the stuff, and that checks out.
So after a night's sleep I decided to optimize:
I hope you can see what I did there. If I've already got one coin of 100p, my maximum for getting 200p while adding 50p coins is 2, or 4-2*g, thus making the making the maximum value for f smaller.
Thing is, this just returns "Total: 1". What's wrong with my code?
P.S: Everything is, actually indented properly. Python editor does it automatically after a colon.
Finally, I'm NOT asking you to give me the answer, that would ruin the fun.
EDIT: I've ran the brute force, just with m instead of four. It wasn't the right answer. Trying again without m. (That means it'll make about a bazillion loops). 2*4*10*20*40*100*200=1.28e9 to be exact. Dang.
*edited*
added code tags to preserve indentation (bloody python....)
Ynot
|
|
Bookmarks