Cod sursa(job #3251424)

Utilizator Ics.maker09Iancu Cezar-Stefan Ics.maker09 Data 25 octombrie 2024 23:37:30
Problema Pascal Scor 30
Compilator cpp-64 Status done
Runda cex_1 Marime 0.53 kb
#include <bits/stdc++.h>
using namespace std;
ifstream f("pascal.in");
ofstream g("pascal.out");
long long l,c,P[5000005],nr,i;
void afis()
{
    for(i=0;i<=l;i++)if(P[i]%c==0)nr++;
    g<<nr;
}
void Pascal()
{
    int aux,aux1=1;
    for(int i=1;i<l;i ++)
    {
        P[0]=P[i]=1;
        aux=P[0] ;
        aux1=P[0] ;
        for(int j=1;j<=l;j++)
        {
            aux=P[j] ;
            P[j]+=aux1;
            aux1=aux;
        }
    }
}
int main()
{
    f >>l >>c;
    Pascal();
    afis();
}