Cod sursa(job #2587471)

Utilizator As932Stanciu Andreea As932 Data 22 martie 2020 18:30:06
Problema Suma si numarul divizorilor Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 1.06 kb
#include <iostream>
#include <fstream>
#include <vector>
#define pmax 1000000
#define ll long long
using namespace std;
ifstream fin("ssnd.in");
ofstream fout("ssnd.out");

const int mo=9973;

int t;
vector <int> primes;
bool v[pmax+5];

void ciur()
{
    v[0]=v[1]=1;
    for(int i=2;i<=pmax;i++)
        if(v[i]==0)
        {
            primes.push_back(i);
            for(int j=2;i*j<=pmax;j++)
                v[i*j]=1;
        }
}

int main()
{
    fin>>t;
    ciur();
    while(t--)
    {
        ll n;
        fin>>n;

        int card=1,sum=1;

        for(int j=0;n>1;j++)
        {
            int p=0;
            ll prod=primes[j];
            while(n%primes[j]==0)
            {
                p++;
                prod*=primes[j];
                n/=primes[j];
            }

            card*=(p+1);
            sum=(sum*((prod-1)/(primes[j]-1)))%mo;
        }
        /*if(card==1)
            fout<<2<<" "<<(1+n)%mo<<"\n";
        else*/
            fout<<card<<" "<<sum%mo<<"\n";
    }

    return 0;
}