Cod sursa(job #2408156)

Utilizator AndreiStrAndrei Stroici AndreiStr Data 17 aprilie 2019 17:49:52
Problema Suma divizorilor Scor 10
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.32 kb
#include <bits/stdc++.h>

using namespace std;
ifstream f("sumdiv.in");
ofstream g("sumdiv.out");
int a,b;
long long s,p=1;

int main()
{
    f>>a>>b;
    for(int i=1;i<=b;i++)
        p*=a;
    for(int d=2;d*d<=p;d++)
        if(a%d==0)
    {
        s+=d;
        s+=p/d;
    }
    g<<s+p+1;
    return 0;
}