Cod sursa(job #3192851)

Utilizator AlexMol089Alex Moldoveanu AlexMol089 Data 13 ianuarie 2024 12:55:04
Problema Suma si numarul divizorilor Scor 10
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.85 kb
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <fstream>

using namespace std;
ifstream fin("ssnd.in");
ofstream fout("ssnd.out");
long long t,n,i,j,d,s;
int main()
{
    fin>>t;
    for(i=1;i<=t;i++)
    {
        fin>>n;
        s=0;
        d=0;
        for(j=1;j*j<n;j++)
        {
            if(n%j==0)
            {
                d=d+2;
                s=s+j;
                s=s+n/j;
            }
        }
        if(j*j==n)
        {
            d++;
            s=s+j;
        }
        fout<<d<<" "<<s<<endl;
    }

    return 0;
}