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?
Input
The only line of input contains an integer m (1 ≤ m ≤ 100 000) — the required number of trailing zeroes in factorial.
Output
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.
Example
Input
1
Output
5
5 6 7 8 9
Input
5
Output
0
Note
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.
题意:让你找N的阶乘的末尾有m个0的数有多少,并输出n.
解法:因为末尾是0和5的个数有关系,n!=n*(n-1)(n-2)…….*1,里面有多少个5,那么结果的末尾就有多少个0
#include<stdio.h>
#include<string.h>
int a[10000];
int main()
{
int n;
while(scanf("%d",&n)!=-1)
{
int i,j;
for(i=1;n>0;i++)//1*2*3*.....*(n-1)*找能被5整除的数
{
int we=i;
while(we%5==0)//找到了就零的个数--
{
we /= 5;
n--;
}
}
if(n<0)
{
printf("0\n");
}
else
{
printf("5\n");
for(int j=i-1;j<=i+3;j++)
{
if(j<i+3)
printf("%d ",j);
if(j==i+3)
printf("%d\n",j);
}
}
}
}