40 lines
707 B
C++
40 lines
707 B
C++
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
typedef long long LL;
|
|
/*
|
|
5^6= 5^1* 5^2 * 5^3
|
|
x=6 tmp=1 ans=1 -->x=6-1=5
|
|
x=5 tmp=2 ans=2 -->x=5-2=3
|
|
x=3 tmp=3 ans=3 -->x=3-3=0
|
|
*/
|
|
LL calc(LL x) {
|
|
int ans = 0;
|
|
for(int i=1;;i++){
|
|
if(x>=i){
|
|
ans++;
|
|
x-=i;
|
|
}else
|
|
break;
|
|
}
|
|
return ans;
|
|
}
|
|
int main() {
|
|
// cout << calc(4) << endl; // 2^4=16 --> 2+4 +8
|
|
LL n;
|
|
cin >> n;
|
|
LL ans = 0;
|
|
for (LL i = 2; i * i <= n; i++) {
|
|
if (n % i == 0) {
|
|
int cnt = 0;
|
|
while (n % i == 0) {
|
|
cnt++;
|
|
n /= i;
|
|
}
|
|
ans += calc(cnt);
|
|
}
|
|
}
|
|
if (n != 1)
|
|
ans += 1; // 剩余质数
|
|
cout << ans << "\n";
|
|
//return 0;
|
|
} |