#include #include
int countDistinctPrimeFactors(int n) { std::set primeFactors;
for (int i = 2; i * i <= n; i++) {
while (n % i == 0) {
primeFactors.insert(i);
n /= i;
}
}
if (n > 1) {
primeFactors.insert(n);
}
return primeFactors.size();
}
int main() { int q; std::cin >> q;
while (q--) {
int number;
std::cin >> number;
int distinctPrimeFactorsCount = countDistinctPrimeFactors(number);
std::cout << distinctPrimeFactorsCount << std::endl;
}
return 0;
}
共 1 条回复
#include #include
int countDistinctPrimeFactors(int n) { std::set primeFactors;
}
int main() { int q; std::cin >> q;
}