#P1134. [USACO3.2] 阶乘问题
[USACO3.2] 阶乘问题
Description
Perhaps you already know what a factorial is; the factorial of is the product from to , for example:
$$12!=1\times 2\times 3\times 4\times 5\times 6\times 7\times 8\times 9\times 10\times 11\times 12=479{,}001{,}600$$The rightmost non-zero digit of the factorial of is .
Write a program to compute the value of the rightmost non-zero digit of the factorial of .
Note: There are trailing zeros in .
Input Format
A single line containing a positive integer .
Output Format
A single integer, the value of the rightmost non-zero digit.
12
6
Hint
USACO Training Section 3.2.
Translated by ChatGPT 5
京公网安备 11011102002149号