Cod sursa(job #1500000)

Utilizator CosminAlexCojocaruCojocaru Cosmin CosminAlexCojocaru Data 11 octombrie 2015 13:46:59
Problema Pascal Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.36 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("pascal.in");
ofstream g("pascal.out");
int main()
{
long long int n,k,i,x,d,u=0;

f >> n; //the number of raws
f>>d;
for(i=0;i<=n;i++)
{
x=1;
for(k=0;k<=i;k++)
{
//cout << x << '\t';
x = x * (i - k) / (k + 1);
if(i==n) if(x%d==0 && x!=0) u++;

}

}
g << u;
return 0;
}