51nod 1003 阶乘后面0的数量
2017-10-25 21:53
281 查看
n的阶乘后面有多少个0?
6的阶乘 = 1*2*3*4*5*6 = 720,720后面有1个0。
Input
Output
Input示例
Output示例
6的阶乘 = 1*2*3*4*5*6 = 720,720后面有1个0。
Input
一个数N(1 <= N <= 10^9)
Output
输出0的数量
Input示例
5
Output示例
1 找n!中2和5的个数取一个min,当然2的肯定比5少
#include<cmath> #include<cstdio> #include<iostream> using namespace std; int get_5(int x) { int ret=0; while(x>=5)ret+=x/5,x/=5; return ret; } int main () { int n; scanf("%d",&n); printf("%d\n",get_5(n)); return 0; }
相关文章推荐
- 51Nod 1003 阶乘后面0的数量
- 51Nod 1003 阶乘后面0的数量(数学,思维题)
- 51NOD 1003 阶乘后面0的数量(一个思维的题目)
- 51nod_1003 阶乘后面0的数量(求N!中5的个数,数论)
- 51NOD 1003 阶乘后面0的数量
- 51nod 1003 阶乘后面0的数量【数学】
- [51NOD] 1003 阶乘后面0的数量 [数学]
- 51Nod-1003-阶乘后面0的数量
- 51Nod 1003 阶乘后面0的数量
- 51nod 1003 阶乘后面0的数量
- 51nod 1003 阶乘后面0的数量
- 51nod-1003 阶乘后面0的数量
- 51Nod-1003 阶乘后面0的数量【分析思维】
- 4000 51Nod 1003 阶乘后面0的数量
- 51nod 1003 阶乘后面0的数量
- 51Nod——1003 阶乘后面0的数量
- 【因子5的个数】1003 阶乘后面0的数量【51nod】
- 51Nod 1003 阶乘后面0的数量
- 51nod 1003 阶乘后面0的数量
- 51nod- 1003 阶乘后面0的数量(求5的个数)