Cod sursa(job #3161983)

Utilizator fortyforBroscoi Mihai fortyfor Data 28 octombrie 2023 11:10:14
Problema Suma si numarul divizorilor Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.77 kb
#include <iostream>
#include <fstream>
std::ifstream fin ("ssnd.in");
std::ofstream fout ("ssnd.out");

int main()
{
    unsigned short t;
    fin >> t;
    unsigned long long L=1000000000001;
    bool C[L]{};
    for (unsigned long long i=2;i<L;i++)
    {
        if (C[i]==false) {
            for (unsigned long long j=2*i;j<=L;j+=i)
            {
                C[j]=true;
            }
        }
    }
    for (int i=0;i<t;i++)
    {
        unsigned long long n;
        fin >> n;
        unsigned short s=0;
        int c=0;
        for (unsigned long long j=1;j*j<=t;t++)
        {
            if (C[j]==false && t%j==0 ){
                c+=1+(j*j!=t);
                s=(s+j+(j*j!=t)*t/j)%9973;
            }
        }
        fout << c << " " << s << "\n";
    }
    return 0;
}