Cod sursa(job #2407861)

Utilizator DavidAA007Apostol David DavidAA007 Data 17 aprilie 2019 12:15:25
Problema Suma si numarul divizorilor Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.83 kb
#include<fstream>
using namespace std;
ifstream fin("ssnd.in");
ofstream fout("ssnd.out");
int t,c,i;
unsigned long long int n,d,x,nrd,sd,y;
int main()
{
    fin>>t;
    for(i=1;i<=t;i++)
    {
        fin>>n;
        d=2;
        x=n;
        nrd=1;
        sd=1;
        while(d*d<=x)
        {
            c=0;
            y=1;
            while(x%d==0)
            {
                c++;
                x=x/d;
                y=y*d;
            }
            if(c>=1)
            {
                y=y*d;
                nrd=nrd*(c+1);
                sd=(sd*((y-1)/(d-1)))%9973;
            }
            d++;
        }
        if(x>1)
        {
            nrd=nrd*2;
            sd=(sd*(x+1))%9973;
        }
        fout<<nrd<<" "<<sd<<"\n";
    }
    fin.close();
    fout.close();
    return 0;
}