Pagini recente » Cod sursa (job #1282022) | Cod sursa (job #2016338) | Cod sursa (job #2355392) | Arhiva de probleme | Cod sursa (job #2193192)
#include <stdio.h>
using namespace std;
unsigned long long row;
int divider;
int main() {
freopen("pascal.in", "r", stdin);
freopen("pascal.out", "w", stdout);
scanf("%lld %d", &row, ÷r);
unsigned long long counter = 0;
unsigned long long ant = 1;
unsigned long long current = 0;
unsigned long limit = (row + 1) / 2;
if (row % 2 == 1) {
limit --;
}
for (unsigned long long k = 0; k < limit; k++)
{
current = ant * (row - k) / (k + 1);
if (current % divider == 0) {
counter += 2;
}
ant = current;
}
if (row % 2 == 0 && (current % divider == 0))
{
counter -= 1;
}
printf("%lld\n", counter);
return 0;
}