数学问题,没考算法
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
int n;
while(cin>>n){
int cnt2 = 0, cnt5 = 0, temp = 2;
while(temp <= n){
cnt2 += n/temp;
temp *= 2;
}
temp = 5;
while(temp <= n){
cnt5 += n/temp;
temp *= 5;
}
cout<<min(cnt2, cnt5)<<endl;
}
}
登录后发布评论
暂无评论,来抢沙发