cp/daily/305hard
2017-03-14 10:23:43 +07:00
..
number.pas Add /r/dailyprogrammer Challenge #305 2017-03-14 10:23:43 +07:00
README.md Add /r/dailyprogrammer Challenge #305 2017-03-14 10:23:43 +07:00

[2017-03-10] Challenge #305 [Hard] Numbers for Sale

Description

KimCo Global, the global corporation from DPRK, is secretly developing an awesome new product for its loyal costumers called Number. It is what is says

  • Number, but not just any Number, each Number is a unique positive integer. Each number costs its value - so 1 costs $1, 5 costs $5, etc. KimCo Global puts each number from 1 to 10^15 on sale.

Your friend, a salesman for KimCo Global, needs your help to optimize their profits. He received all available Numbers whose sum of digits equals 69 and seeks to sell them for the highest value he can. His regular accountant is of no help, can you assist?

What is the total of positive integers less than 10^15 whose sum of digits equal 69?

Credit

This challenge was suggested by user /u/raluralu, many thanks. If you have any challenge ideaas, please do share them on /r/dailyprogrammer_ideas and there's a good chance we'll use them.

EDIT 2017-03-11

There's been some discussion about the ambiguity of this challenge - is it asking for the sum of all of those Numbers or the quantity of Numbers that fit the constraint? I have to admit the original submission from /r/dailyprogrammer_ideas was also a bit ambiguous. I believe the submitter who wrote it does not speak English natively, and so they had some ambiguity in their presentation. As such, I copied their question complete with ambiguity.

Because of this, I think either will be fine - the sum or the quantity.

The real challenge, and why this is a Friday hard one, is writing a better than naive solution as some of you have picked up. Some of it is math and some of it is programming.