Cod sursa(job #3302961)

Utilizator nopreanOprean Natasha noprean Data 12 iulie 2025 13:55:53
Problema Suma si numarul divizorilor Scor 30
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.86 kb
#include <bits/stdc++.h>

using namespace std;
ifstream fin("ssnd.in");
ofstream fout("ssnd.out");
const int MOD=9973;
int main()
{
    int t,n;
    fin>>t;

    for(int i=1;i<=t;i++)
    {
        int sumaDiv=1;
        int nrDiv=1;
        fin>>n;
        for(int f=2;f*f<=n;f++)
        {
            if(n%f==0)
            {
                int e=0;
                int prod=1;
                while(n%f==0)
                {
                    e++;
                    n/=f;
                    prod*=f;
                }
                prod*=f;
                nrDiv*=(e+1);
                sumaDiv=(sumaDiv*((prod-1)/(f-1)))%MOD;
            }
        }
        if(n>1)
        {
            nrDiv*=2;
            sumaDiv=(sumaDiv*((n*n)/(n-1)))%MOD;
        }
        fout<<nrDiv<<" "<<sumaDiv<<'\n';
    }

    return 0;
}