#P2064. 奇妙的汽车
奇妙的汽车
Description
You have a wonderful car with an auto-acceleration feature. For example, on day you can drive a distance of . Then on day , you can increase the distance to one of to times that of day (it must be one of these integers), that is, from to . On day , the distance will be to times that of day , and so on. In other words, on day , the distance must be to times that of day , and it must be an integer multiple of it.
You are eager to drive this car from city to city for a trip and show off this extraordinary car along the way. You already know the total mileage you need to travel. Please determine the day distance and the multiplier used each subsequent day so that the total distance is exactly and the number of days is minimized.
However, because you want to show off your car properly and for safety reasons, you are required to spend at least days. If no such plan exists, output -1.
Input Format
A positive integer , representing the distance from city to city .
Output Format
A single integer representing the minimum number of days required; if there is no solution, output -1.
15121
-1
571
5
Hint
Constraints
- For of the testdata, .
- For of the testdata, .
- For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号