Cod sursa(job #3274516)

Utilizator bogdan1479Luca Bogdan Alexandru bogdan1479 Data 6 februarie 2025 23:17:35
Problema Pascal Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.32 kb
#include <fstream>

using namespace std;

ifstream fin("pascal.in");
ofstream fout("pascal.out");

int n, aux, p;
long long sol = 1;

int main()
{
    fin >> n >> p;
    aux = n;
    while(n)
    {
        sol *= n % p + 1;
        n /= p;
    }
    sol = aux + 1 - sol;
    fout << sol;
    return 0;
}