MYSTERY - Số huyền bí
Tác giả: skyvn97
Ngôn ngữ: C++
#include<bits/stdc++.h>
const int mod=20122007;
int pw(int a,int b) {
int res=1;
int mul=a;
while (b>0) {
if (b&1) res=1LL*res*mul%mod;
mul=1LL*mul*mul%mod;
b>>=1;
}
return (res-1);
}
int main(void) {
int n;
scanf("%d",&n);
int pro=1;
for (int i=1;i*i<=n;i=i+1) if (n%i==0) {
pro=1LL*pro*pw(3,i)%mod;
if (i*i<n) pro=1LL*pro*pw(3,n/i)%mod;
}
printf("%d",pro);
return 0;
}