The number of units
In arithmetic expression you are allowed to use the number 1, operations of addition, multiplication and parenthesis. What is the minimum number of ones you need to obtain the positive integer n?
Specifications
Input
One number n (1 ≤ n ≤ 5000).
Output
The required number of ones.
Problem information
Time Limit: 1 secondsMemory Limit: 64 MB
Balls for the passed test: 6.25
Complexity: 44% 222/395
Classes: Dynamic programming
Example
Example input7 |
Example output6 |
| ← Competitors’ quantity of olimpia | Problems | The Fuel → |
