Pagini recente » Cod sursa (job #1755652) | Cod sursa (job #2815480) | Cod sursa (job #2017775) | Clasament eusebiu_oji_2010_cls11-12 | Cod sursa (job #2164064)
#include <iostream>
#include <fstream>
#define MODULO 9973
using namespace std;
ifstream in("ssnd.in");
ofstream out("ssnd.out");
int nr_diviz,suma;
void rez(int n){
int d = 2,exp = 0,copie = n;
nr_diviz = 1,suma = n+1;
while(d*d <= n){
exp = 0;
while(n % d == 0){
n /= d;
exp++;
}
if(exp > 0)
nr_diviz *= (exp+1);
d++;
}
if(n > 1)
nr_diviz *= 2;
n = copie;
for(d = 2; d * d < n; d++)
if(n % d == 0)
suma += n/d + d;
if(d * d == n)
suma += d;
}
int main()
{
int t,nr;
in>>t;
for(int i = 0; i < t; i++){
in>>nr;
rez(nr);
out<<nr_diviz<<" "<<suma<<"\n";
}
return 0;
}