http://acm.hdu.edu.cn/showproblem.php?pid=1124
求n!末尾有多少个0,2*5出0,所以既求有多少个因子5
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
#include <iostream> using namespace std ; int main() { int t; scanf("%d",&t); while(t--) { int n; scanf("%d",&n); int ans=0; while(n) { n/=5; ans+=n; } printf("%d\n",ans); } return 0; }