You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
521 B
33 lines
521 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
//分解质因数
|
|
|
|
const int N = 110;
|
|
int a[N], al;
|
|
|
|
//判断素数
|
|
|
|
bool isPrime(int n) {
|
|
for (int i = 2; i <= n / i; i++)
|
|
if (n % i == 0) return false;
|
|
return true;
|
|
}
|
|
|
|
void divide(int n) {
|
|
for (int i = 2; i <= n; i++) {
|
|
while (isPrime(i) && n % i == 0) {
|
|
a[++al] = i;
|
|
n /= i;
|
|
}
|
|
}
|
|
}
|
|
|
|
int main() {
|
|
int n;
|
|
cin >> n;
|
|
divide(n);
|
|
cout << al << endl;
|
|
return 0;
|
|
} |