Cod sursa(job #2407827)
| Utilizator | Data | 17 aprilie 2019 11:51:39 | |
|---|---|---|---|
| Problema | Suma si numarul divizorilor | Scor | 10 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.8 kb |
#include<fstream>
using namespace std;
ifstream fin("ssnd.in");
ofstream fout("ssnd.out");
int t,c,i;
long long n,d,x,nrd,sd,y;
int main()
{
fin>>t;
for(i=1;i<=t;i++)
{
fin>>n;
d=2;
x=n;
nrd=1;
sd=1;
while(d*d<=n)
{
c=0;
y=1;
while(x%d==0)
{
c++;
x=x/d;
y=y*d;
}
y=y*d;
if(c>=1)
{
nrd=nrd*(c+1);
sd=sd*((y-1)/(d-1));
}
d++;
}
if(x>1)
{
nrd=nrd*2;
sd=sd*(x+1);
}
fout<<nrd<<" "<<sd<<"\n";
}
fin.close();
fout.close();
return 0;
}
