Cod sursa(job #1397092)
Utilizator | constantin teodor teoceltare | Data | 23 martie 2015 11:37:44 |
---|---|---|---|
Problema | Suma si numarul divizorilor | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.48 kb |
#include<fstream>
#include<iostream>
#include<cmath>
using namespace std;
ifstream fin("ssnd.in");
ofstream fout("ssnd.out");
void fct(long long x)
{
long long s;
for(long long a1=1;a1<=sqrt(x);a1++)
{
if(x%a1==0)
{
s+=a1;
}
}
fout<<s<<'\n';
}
void citire()
{
long long n,x;
fin>>n;
for(int a1=1;a1<=n;a1++)
{
fin>>x;
fct(x);
}
}
int main()
{
citire();
}