#include <iostream>
#include <algorithm>
#include <numeric>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
cin>>n;
// 2 3 5 6 10 15 30
int two = 0;
int three = 0;
int five = 0;
while (n--)
{
int a;
cin>>a;
while (a %2 == 0)
{
a/=2;
two++;
}
while (a %3 == 0)
{
a/=3;
three++;
}
while (a%5==0)
{
a/=5;
five++;
}
}
int res = min(two,three);
cout<<min(res,five);
return 0;
}
// 64 位输出请用 printf("%lld")
30可以分解位2*3*5;
把数组每个元素都拆解2 3 5;
他们中最小的就是总积的30的个数

京公网安备 11010502036488号