Cod sursa(job #944861)

Utilizator mitrutstrutMitrea Andrei Ionut mitrutstrut Data 29 aprilie 2013 21:56:45
Problema Pascal Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.33 kb
#include <iostream>
#include <fstream>
 
using namespace std;
 
ifstream f("pascal.in");
ofstream g("pascal.out");
int main()
{
long long  n,k,i,x,l,m=0;
f >> n>>l; //the number of raws
for(i=0;i<=n;i++)
{
x=1;
for(k=0;k<=i;k++)
{
if(i==n && x%l==0)
    m++;
x = x * (i - k) / (k + 1);
}
}
    g<<m;
return 0;
}