| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
题目就是求n!末位0的个数。。很简单#include <iostream>
using namespace std;
int f(int n)
{
int k=0;
while (n>=5)
{
n/=5;
k+=n;
}
return k;
}
int main()
{
int t,n;
cin >> t;
while (t--)
{
cin >> n;
cout << f(n) << endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator