#P6583. 回首过去
回首过去
Background
Will you think of tomorrow,
the problems you did not finish debugging yesterday?
Will you still remember tomorrow,
the brute force that failed in the contest?
Problem Description
Back in elementary school, Little Z had already started learning OI.
Once in a math class, the teacher asked this question: Find the number of ordered integer pairs such that and can be written as a terminating decimal.
Of course, Little Z quickly worked it out.
But since he had learned OI, he generalized it:
Given a positive integer , find the number of ordered integer pairs such that and can be written as a terminating decimal.
At that time, he was still a newbie (cai ji, “菜鸡”) and only knew the brute force.
A few years later, he happened to see this problem again. Now he knows a better method, so he turned it into a problem for you to solve.
Input Format
One line containing a positive integer .
Output Format
One line containing an integer, the answer.
3
7
5
21
Hint
Explanation for Sample 1
, , , , , , can all be written as terminating decimals.
Constraints
- Subtask 1 (40 points), .
- Subtask 2 (40 points), .
- Subtask 3 (20 points), .
Translated by ChatGPT 5