Cod sursa(job #3192845)

Utilizator AlexMol089Alex Moldoveanu AlexMol089 Data 13 ianuarie 2024 12:51:42
Problema Suma si numarul divizorilor Scor 0
Compilator cpp-32 Status done
Runda Arhiva educationala Marime 0.84 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("ssdn.out");
int 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;
}