Mai intai trebuie sa te autentifici.
Cod sursa(job #2262561)
Utilizator | Data | 17 octombrie 2018 16:48:23 | |
---|---|---|---|
Problema | Suma si numarul divizorilor | Scor | 30 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.75 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("ssnd.in");
ofstream fout("ssnd.out");
int ptr(int x,int e)
{
int r=1;
while(e>0)
{
if(e%2==0)
{
x=x*x;
e/=2;
}
else
{
r*=x;
e--;
}
}
return r;
}
void fprimi(int n)
{
int d=2,pr=1,s=1;
while (n>1)
{int p=0;
while (n%d==0)
{
n/=d;
p++;
}
if(p>0) {pr=pr*(p+1);
s=s*(ptr(d,p+1)-1)/(d-1);}
d++;
}
fout<<pr<<" "<<s%9973<<endl;
}
int main()
{
int t,n;
fin>>t;
for(int i=1;i<=t;i++)
{
fin>>n;
fprimi(n);
}
return 0;
}