Cod sursa(job #2383846)
Utilizator | Data | 19 martie 2019 20:36:00 | |
---|---|---|---|
Problema | Suma divizorilor | Scor | 30 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <fstream>
#include <math.h>
using namespace std;
ifstream f("sumdiv.in");
ofstream g("sumdiv.out");
int sdiv(int n)
{
int i = 1, s = 0;
while(i <= n / 2)
{
if(n % i == 0) s = s + i;
i ++;
}
return s + n;
}
int a, b;
unsigned long long ab;
int main()
{
f >> a >> b;
ab = pow(a, b);
g << sdiv(ab) % 9901;
return 0;
}