Pagini recente » Cod sursa (job #1222194) | Borderou de evaluare (job #1762839) | Cod sursa (job #482402) | Cod sursa (job #2591705) | Cod sursa (job #1988605)
#include <fstream>
#include <cmath>
#define ll long long
using namespace std;
ifstream fin("ssnd.in");
ofstream fout("ssnd.out");
bool v[1000001];
int vect[260001],putere1[25001],divizor[25001];
ll cnt=0,i,j;
void ciur()
{
for(i=2; i<=1000000; i++)
{
if(v[i]==0)
{
cnt++,vect[cnt]=i;
for(j=i*i; j<=1000000; j+=i) v[j]=1;
}
}
}
int main()
{
int t,cnt1,val=-1,putere,x,copie,k,l;
ll n,S,P;
fin >> t;
ciur();
for(i=1; i<=t; i++)
{
fin >> n,j=1,cnt1=0,P=1,S=1,putere=0;
while(n>1)
{
copie=vect[j];
if(n%copie==0) n/=copie,putere++,val=copie;
else cnt1++,putere1[cnt1]=putere,divizor[cnt1]=val,putere=0,j++;
}
cnt1++,putere1[cnt1]=putere,divizor[cnt1]=val;
for(k=1; k<=cnt1; k++)
{
x=1;
for(l=1; l<=(putere1[k]+1); l++)
x*=divizor[k];
P*=(putere1[k]+1),S*=(pow(divizor[k],putere1[k]+1)-1)/(divizor[k]-1),S=S%9973;
}
fout << P << " " << S << "\n";
}
return 0;
}