标签:com http blog class style div img code java javascript log
题意:求N!中末尾0的个数 其实就是5的个数 因为2*5=10 肯定n中2的个数比5的个数多
#include<iostream> using namespace std; int main() { int n; int t,d; int sum; scanf("%d",&t); while(t--) { sum=0; scanf("%d",&n); sum=n/5;n=sum; while(n/5!=0) { sum+=n/5; n=n/5; } printf("%d\n",sum); } return 0; }
标签:com http blog class style div img code java javascript log
原文地址:http://www.cnblogs.com/zhangdashuai/p/3697109.html