Cod sursa(job #654382)

Utilizator yero007Daniel Iulian yero007 Data 30 decembrie 2011 13:31:13
Problema Pascal Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.49 kb
/*pascal - info arena

http://infoarena.ro/problema/pascal

*/
#include<cstdio>
using namespace std;
long long r,d,v[5000],i,j;
int f(int x)
{ 
	if (x==0)
		return 1;
	else return f(x-1)*x;
}
void citire()
{
	freopen("pascal.in", "r",stdin);
	scanf("%d %d", &r,&d);
}
int main()
{
	citire();
	for (j=1;j<=(r/2)+1;j++)
	{
		v[j]=f(r)/(f(r-j)*f(j));
	}
	int tot=0;
	for(i=1;i<=(r/2)+1;i++)
		if(v[i]%d==0)
			tot++;
	freopen("pascal.out","w",stdout);
	printf("%d",tot);
}