Cod sursa(job #1311738)
Utilizator | Data | 8 ianuarie 2015 15:56:56 | |
---|---|---|---|
Problema | Suma si numarul divizorilor | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.55 kb |
#include<fstream>
using namespace std;
long long a,x,y,t,c,s;
int main()
{
ifstream fin("ssnd.in");
ofstream fout("ssnd.out");
fin>>t;
x=1;
while(x<=t)
{
fin>>a;
s=0;
c=0;
y=1;
while(y*y<a)
{
if(a%y==0)
{
s=s+y+a/y;
c=c+2;
}
y=y+1;
}
if(y*y==a)
{
c++;
s=s+y;
}
fout<<c<<" "<<s<<"\n";
x=x+1;
}
return 0;
}