Chanukah Challenge: Difference between revisions

From programming_contest
Jump to navigation Jump to search
imported>Kmk21
Created page with "This problem asks how many hannukah candles we would have to light if it were a different number of days. If we're really lazy, we can brute force it and iterate day by day...."
 
(No difference)

Latest revision as of 22:38, 27 December 2017

This problem asks how many hannukah candles we would have to light if it were a different number of days.

If we're really lazy, we can brute force it and iterate day by day. If we're a little less lazy, it's just

sum(1..n) + n

If you don't how to sum the numbers from one to N, perhaps send Professor Astrachan an email. (or you could brute force/precompute them!)