ac

!i  •  1个月前


include

using namespace std; int countZeros(int n, int arr[]) {

int countTwo = 0;
int countFive = 0;

for (int i = 0; i < n; i++) {
    int num = arr[i];

    while (num % 2 == 0) {
        countTwo++;
        num /= 2;
    }

    while (num % 5 == 0) {
        countFive++;
        num /= 5;
    }
}

return std::min(countTwo, countFive);

}

int main() {

int n;
std::cin >> n;

int arr[100];
for (int i = 0; i < n; i++) {
    std::cin >> arr[i];
}

int zeros = countZeros(n, arr);
std::cout << zeros << std::endl;

return 0;

}


Comments:

请先登录,才能进行评论