Pagini recente » Cod sursa (job #630417) | Cod sursa (job #261535) | Cod sursa (job #431831) | Cod sursa (job #2189447) | Cod sursa (job #2184310)
#include <iostream>
#include <fstream>
#define M 9973
using namespace std;
void euclid(long long a, long long b, long long &x, long long &y)
{
if (!b)
{
x=1;
y=0;
return;
}
euclid(b, a%b, x, y);
long long aux;
aux=y;
y=x-(a/b)*y;
x=aux;
}
int main()
{
ifstream fin("ssnd.in");
ofstream fout("ssnd.out");
long long n, s, p, pr, x, y;
int t, d, nr;
fin >> t;
for (int i=1; i<=t; i++)
{
fin >> n;
d=2;
s=1;
p=1;
while(n>1)
{
nr=0;
pr=1;
while(n%d==0)
nr++,n/=d,pr*=d;
pr*=d;
pr--;
if (nr)
{
s=s*(nr+1);
p=((p%M)*(pr%M))%M;
euclid(d-1, M, x, y);
while(x<0)
x+=M;
p=((p%M)*(x%M))%M;
}
d++;
}
fout << s << " " << p << "\n";
}
return 0;
}