Cod sursa(job #3251186)

Utilizator DobrePetruDobre Petru Daniel DobrePetru Data 25 octombrie 2024 11:59:18
Problema Pascal Scor 0
Compilator cpp-64 Status done
Runda cex_1 Marime 0.89 kb
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>
using namespace std;
ifstream fin("pascal.in");
ofstream fout("pascal.out");
unsigned long long c[1000005][1000005],n,k,i,j,t;
int main()
{
    fin>>n>>k;
    c[0][0]=1;
    for(i=1; i<=n; i++)
    {
        c[i][0]=c[i][i]=1;
        for(j=1; j<i; j++)
        {
            c[i][j]=c[i-1][j-1]+c[i-1][j];
        }
    }
    for(i=1; i<=n; i++)
    {
        for(j=1;j<n; j++)
        {
           if(i==n&&c[i][j]%k==0) t++; 
        }
    }
    if(k==1) t+=2;
    fout<<t;
    return 0;
}