傳送門:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
| int T,M,N,K,I,a,b,c,ans,cnt;
int arr[100000], flag, sum;
ll frac[50];
void sol(){
flag = sum = 0;
for(int i=2;i*i<=a;i++)if(a%i == 0){
int cnt = 0;
while(a>1 && a%i==0)
++cnt, a/=i;
arr[flag++] = cnt;
sum += cnt;
}
if(a>1) {
++sum;
arr[flag++] = 1;
}
ll ans = frac[sum];
for(int i=0;i<flag;i++) ans /= frac[arr[i]];
cout << sum << " " << ans << endl;
}
void build(){
frac[1] = 1;
for(int i=2;i<50;i++) frac[i] = frac[i-1] * i;
}
int main(){
build();
while(cin>>a){
sol();
}
} |
comments powered by