Cod sursa(job #443270)

Utilizator thesilverhand13FII Florea Toma Eduard thesilverhand13 Data 16 aprilie 2010 16:36:56
Problema Pascal Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.39 kb
#include<fstream>
using namespace std;
int fact(int n)
{
      if(n==0||n==1)
     return 1;
     else
     return n*fact(n-1);
}
long long i,d,j,n,l,nr;
int main()
{
      ifstream f("pascal.in");
	  ofstream g("pascal.out");
	  f>>n>>d;
	  for(i=0;i<=n;i++)
	  {
		     l=fact(n)/(fact(n-i)*fact(i));
	         if(l%d==0)
		     nr++;
	 }
	 
	 g<<nr;
	 return 0;
}