Cod sursa(job #583054)
Utilizator | Data | 17 aprilie 2011 16:34:06 | |
---|---|---|---|
Problema | Suma divizorilor | Scor | 20 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include<fstream>
#include<cmath>
using namespace std;
ifstream f("sumdiv.in");
ofstream g("sumdiv.out");
int main()
{long long d,pu2;
long double a,b,pu,s;
f>>a>>b;
if(a==0) s=0;
else if(b==0) s=1;
else if(a==1) s=1;
else
{pu=pow(a,b);
pu2=pu;
for(d=1;d<=pu2/2;d++)
if(pu2%d==0) s+=d;
s+=pu;
}
g<<s;
return 0;
}