Interesting Number
Time limit2sMemory limit1024 MB
Given n up to 1000, find the smallest positive integer with digit sum n that is also divisible by n.
- Level
Hard8 of 10
- Topics
- Dynamic programming, BFS, Number theory, Greedy
- Solved
- No attempts yet
Problem
For a given number , find the smallest positive integer whose digit sum is and which is divisible by .
Input
The input file contains a single integer ().
Output
The output file must contain the required number. Leading zeros are not allowed.