Pagini recente » Cod sursa (job #118563) | Cod sursa (job #1837810) | Cod sursa (job #2707768) | Cod sursa (job #2946376) | Cod sursa (job #572653)
Cod sursa(job #572653)
#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;
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;
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;
}