Pagini recente » Cod sursa (job #400768) | Cod sursa (job #913275) | Cod sursa (job #2156275) | Cod sursa (job #690654) | Cod sursa (job #572683)
Cod sursa(job #572683)
#include <fstream>
#define Nmax 1000003
#define LL long long
#define Mod 9901
using namespace std;
ifstream fin("sumdiv.in");
ofstream fout("sumdiv.out");
int A,B;
inline int put(int a,LL b){
int p=a%Mod,rez=1; LL i;
for(i=0;(1LL<<i)<=b;++i){
if( b & (1LL<<i) ) rez=(rez*p)%Mod;
p=(p*p)%Mod;
}
return rez;
}
inline void solve(){
int sum=1,n1,n2, P; LL e;
for(P=2; 1LL*P*P<=A; ){
if( A % P ){ if(P%2)P+=2; else P++; continue; }
for( e=0; A%P==0; ) e++, A/=P;
e = e*B;
if( P % Mod ==1 ){
sum = (1LL*sum*((e+1)%Mod))%Mod;
}else{
n1=(put(P,e+1)-1+Mod)%Mod;
n2=put(P-1,Mod-2);
sum=(1LL*sum*n1*n2)%Mod;
}
if( P%2 ) P+=2; else P++;
}
if( A>1 ){
e=B; P=A;
if( P % Mod ==1 ){
sum = (1LL*sum*((e+1)%Mod))%Mod;
}else{
n1=(put(P,e+1)-1+Mod)%Mod;
n2=put(P-1,Mod-2);
sum=(1LL*sum*n1*n2)%Mod;
}
}
fout<<sum<<"\n";
}
int main(){
int i,q; LL X;
fin>>A>>B;
solve();
fin.close(); fout.close();
return 0;
}