变相的问你N!后面0的个数而已,公式
#include<bits/stdc++.h> using namespace std; int cnt(int x){ if(x<5)return 0; else return x/5+cnt(x/5); } int main(){ int n; while(~scanf("%d",&n)){ printf("%d\n",cnt(n)); } }
变相的问你N!后面0的个数而已,公式
#include<bits/stdc++.h> using namespace std; int cnt(int x){ if(x<5)return 0; else return x/5+cnt(x/5); } int main(){ int n; while(~scanf("%d",&n)){ printf("%d\n",cnt(n)); } }