17
Flid
4 14 30
1325/ 1695
Last seen 5 years ago
Member for 11 years, 2 months, 23 days
Difficulty Normal
Best reviews / Newest reviews
First-old_user 4
Brute forcing is a horrible thing, really. Dynamic programming for 0-1 knapsack gives you a fast and nice solution. More
Second-yoichi 1 1
Hint: [1, 2, 3][2:10] == [3], [1, 2, 3][max(0, n-1):n+2] works great for any 'n' More
First-Sim0000 1
Yes, it's going to work, BUT it hardly makes you 750 best gifts. Other solution (with calculating mathematical expectation of max value of upcoming gifts) gives you much better result - about 850 best gifts. But anyway, your code does just what it should do, nice ;) More
First-Flid
Hm... You are right, thank you! More
Generatedi5-gygash
And, again, it's a bruteforcing. Never use it if it's not the only way. More
First-heni
And, again, it's a bruteforcing. Never use it if it's not the only way. More
First-Dad
How does it work? Too many code lines without a single comment More
First-yzwcroco
And, again, it's a bruteforcing. Never use it if it's not the only way. More
First-cfenoy
stones_aux = list(stones) - it's better to use stones[:] to copy lists. And, again, it's a bruteforcing. Never use it if it's not the only way. More
First-Sim0000 1
Hey! Why doesn't this task accept solutions? I've got completely new solution 10 lines long (total) instead of the monstrous original one :( More
First-Jaco_enox
Why do you need to store all the intermediate data in a? You can just write: sum((from_date + timedelta(days = i)).weekday() > 4 for i in xrange(delta.days+1)) It will use constant space (because of generators xrange and (... for i in ...)) instead of linear. More
First-Bilou06
Maybe INFINITY = float('inf') ? More
First-Miaou
Nice and clear... I like it! I don't know why everybody tries to write one line of mess instead of ten lines of readable code with comments. More
Hinted-veky 1
Good solution, but with needless use of lambda and some PEP8 errors. More
reduce-Cjkjvfnby -1 1
http://www.checkio.org/mission/digits-multiplication/publications/Flid/python-27/reduce/ "reduce" should not be imported. The other lines are equal! More