Mr. Santa asks all the great programmers of the world to solve a trivial problem. He gives them an integer m and asks for the number of positive integers n, such that the factorial of n ends with exactly m zeroes. Are you among those great programmers who can solve this problem?
The only line of input contains an integer m (1 ≤ m ≤ 100 000) — the required number of trailing zeroes in factorial.
First print k — the number of values of n such that the factorial of n ends with m zeroes. Then print these k integers in increasing order.
1
5 5 6 7 8 9
5
0
The factorial of n is equal to the product of all integers from 1 to n inclusive, that is n! = 1·2·3·...·n.
In the first sample, 5! = 120, 6! = 720, 7! = 5040, 8! = 40320 and 9! = 362880.
额,每次都能遇到一些新的知识点。可喜可贺可喜可贺......
题目大意:就是一个阶乘中有几个0。
首先思考一下,因为在一个数字中,2作为因子的次数肯定比5多。那么就只需要考虑5出现过几次就可以了。然后就是解释一下为什么25的时候是6个0,因为25中有两个5,所以一共就有6个0。
来一个例子
从1到10,连续10个整数相乘:
从1×2×3×4×5×6×7×8×9×10中可以得出其中5的因数有2个,所以它们的乘积末尾有2个0
从1到20,20个整数相乘:从中可以得出其中5的因数有4个,所以它们的乘积末尾有4个0
从1到30,30个整数相乘:从中可以得出其中5的因数有5,但25中有2个5,所以一共是6个,所以它们的乘积末尾有6个0
#include
#include
#include
#include
#include
#include
#include