Pagini recente » Cod sursa (job #651572) | Cod sursa (job #3236802) | Cod sursa (job #2829602) | Cod sursa (job #47552) | Cod sursa (job #2924830)
#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;
}