输入为一行,n(1 ≤ n ≤ 1000)
输出一个整数,即题目所求
10
2
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <iomanip> //不能写成#include <iomanip.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv)
{
int n;
int num;
int zero_num=0;
int temp;
scanf("%d",&n);
for(int k=1;k<n+1;k++)
{
temp=k;
num=0;
while((temp>=5)&&(temp%5==0))
{
num++;
temp=temp/5;
}
zero_num+=num;
}
cout<<zero_num<<endl;
return 0;
}
原文:http://www.cnblogs.com/panlangen/p/7758138.html