Cod sursa(job #798764)

Utilizator icb_mnStf Cic icb_mn Data 17 octombrie 2012 10:09:55
Problema Suma si numarul divizorilor Scor 10
Compilator cpp Status done
Runda Arhiva educationala Marime 0.55 kb
#include<fstream>
#define LL long long
using namespace std;

LL n;
int t;

int main()
{
    ifstream f("ssnd.in");
    ofstream g("ssnd.out");

    f>>t;

    for(int i = 1; i <= t; ++i)
    {
        f>>n;
        LL nr = 2;
        LL sum = n + 1;
        if(n == 1)nr = 1,sum = 1;
        else
        {
        for(LL j = 2; j <= n / 2; ++j)
            if(!(n % j))
            {
                nr++;
                sum += j;
            }
        }
        g<<nr<<' '<<sum<<'\n';
    }

    g.close();

    return 0;
}