Cod sursa(job #3274517)
Utilizator | Data | 6 februarie 2025 23:18:32 | |
---|---|---|---|
Problema | Pascal | Scor | 40 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.31 kb |
#include <fstream>
using namespace std;
ifstream fin("pascal.in");
ofstream fout("pascal.out");
long long sol = 1, n, aux, p;
int main()
{
fin >> n >> p;
aux = n;
while(n)
{
sol *= n % p + 1;
n /= p;
}
sol = aux + 1 - sol;
fout << sol;
return 0;
}