Cod sursa(job #2458315)
| Utilizator | Data | 20 septembrie 2019 10:39:37 | |
|---|---|---|---|
| Problema | Suma si numarul divizorilor | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 1.02 kb |
#include <fstream>
using namespace std;
ifstream fin("ssnd.in");
ofstream fout("ssnd.out");
bool ciur[1000001];
long long m,d,i,v[1000001],n,x,t,s,p,j,t1;
int main()
{
for(d=2; d<=1000000; d++)
{
if(ciur[d]==0)
{
v[++m]=d;
for(i=d*d; i<=1000000; i+=d)
ciur[i]=1;
}
}
fin>>n;
for(i=1; i<=n; i++)
{
fin>>x;
j=1;
t=1;
t1=1;
s=1;
while(v[j]*v[j]<=x&&x>1)
{
p=0;
while(x%v[j]==0)
{
p++;
x/=v[j];
t1*=v[j];
}
if(p!=0)
{
t*=p+1;
s*=(t1*v[j]-1)/(v[j]-1);
s%=9973;
}
j++;
t1=1;
}
if(x>1)
{
t*=2;
s*=(x*x-1)/(x-1);
s%=9973;
}
fout<<t<<" "<<s%9973<<'\n';
}
return 0;
}
