Cod sursa(job #2156368)
| Utilizator | Data | 8 martie 2018 18:05:06 | |
|---|---|---|---|
| Problema | Suma si numarul divizorilor | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.61 kb |
#include<iostream>
#include<cmath>
#include<fstream>
using namespace std;
ifstream f("ssnd.in");
ofstream g("ssnd.out");
long long n,t;
void solve()
{
f>>n; int produs=1,produssuma=1;
if(n==0) {g<<0; return;}
int d=2;
while(n!=1)
{
if(n%d==0)
{
int p=0;
while(n%d==0) {p++;n/=d;}
produs*=p+1;
produssuma*=((pow(d,p+1)-1)/(d-1));
}
d++;
}
if(produs==2) produssuma++;
g<<produs<<" "<<produssuma<<endl;
}
int main()
{
f>>t;
for(int z=1;z<=t;z++)
solve();
return 0;
}
