Cod sursa(job #2924830)
| Utilizator | Data | 11 octombrie 2022 17:46:15 | |
|---|---|---|---|
| Problema | Pascal | Scor | 20 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.47 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("pascal.in");
ofstream fout("pascal.out");
int fact(int x)
{
if (x < 1)
return 1;
else
return fact(x - 1) * x;
}
int main()
{
int R, D, nr = 0;
fin >> R >> D;
for (int j = 0; j < R + 1; j++)
{
int elem = fact(R) / (fact(R - j) * fact(j));
if (elem % D == 0)
nr++;
}
fout << nr;
return 0;
}
