蓝桥杯2018省赛A组第3题
题目链接http://oj.ecustacm.cn/problem.php?id=1361
思路:找出2,5的个数,取最小的即可
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
int a=0, b=0;
int t;
for (int i = 0; i < 100; i++) {
cin >> t;
while (t && t % 2 == 0) {
a++;
t /= 2;
}
while (t && t % 5 == 0) {
b++;
t /= 5;
}
}
cout << min(a, b);
return 0;
}
答案直接输出 :31即可,不用加输入的100个数据
罗老师代码链接https://blog.csdn.net/weixin_43914593/article/details/112560449