Equal Digit Sums
Time limit2sMemory limit256 MB
Pick n distinct positive integers with the same digit sum so their total is as small as possible.
- Level
Medium7 of 10
- Topics
- Math, Greedy, Brute force
- Solved
- No attempts yet
Problem
The digit sum of a positive integer is the sum of its decimal digits. For example, , , and all have digit sum .
Pick distinct positive integers whose digit sums are all equal. Write a program that finds the smallest total the picked numbers can have.
Input
The first line contains an integer ().
Output
Print the minimum possible sum of distinct positive integers that all have the same digit sum.