Cod sursa(job #515780)
Utilizator | Tamasan Antonia antonya | Data | 22 decembrie 2010 13:06:50 |
---|---|---|---|
Problema | Suma si numarul divizorilor | Scor | 70 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.49 kb |
#include<iostream.h>
#include<fstream.h>
#include<math.h>
int main()
{ifstream f("ssnd.in");
ofstream g("ssnd.out");
short int t;int k=0, d=2;
long long n;
f>>t;
for(t; t; --t)
{f>>n; long long suma=1; int nrdiv=1;
d=2;
while (n>1)
{ if (n%d==0)
{
while (n%d==0)
{k++; n=n/d;}
nrdiv*=k+1;
suma*=(pow(d,k+1)-1)/(d-1);
}
d++;k=0;
}
g<<nrdiv<<" "<<suma%9973<<"\n";
}
f.close();
g.close();
return 0;}