Cod sursa(job #2162272)
Utilizator | Noroc Andrei Mihail andreiutu111 | Data | 12 martie 2018 09:37:04 |
---|---|---|---|
Problema | Suma si numarul divizorilor | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.57 kb |
#include<bits/stdc++.h>
using namespace std;
ifstream f("ssnd.in");
ofstream g("ssnd.out");
long long N,nr,s,T;
void descpafact(long long x){
long long f=2,n=x,po;
nr=s=1;
while(f*f<=n){
int p=0;
po=1;
while(!(x%f))++p,x/=f,(po*=f)%9973;
nr*=(p+1),(po*=f)%9973;
s=(s*((po-1)/(f-1)))%9973;
if(f==2)++f;
else f+=2;
}
if(x>1)++nr,s=(s*(x+1))%9973;
}
int main()
{
f>>T;
while(T--){
f>>N;
descpafact(N);
g<<nr<<' '<<s<<'\n';
}
return 0;
}