We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
#include<cmath>#include<cstdio>#include<vector>#include<iostream>#include<algorithm>#define P 1000000000usingnamespacestd;intmain(){longa[1000][1000];for(inti=0;i<1000;i++){for(intj=0;j<=i;j++){if(j==0)a[i][j]=1;elseif(i==j)a[i][j]=1;elsea[i][j]=(a[i-1][j-1]%P+a[i-1][j]%P)%P;}}intt;cin>>t;while(t--){intn;cin>>n;for(intj=0;j<=n;j++)cout<<a[n][j]<<" ";cout<<endl;}/* Enter your code here. Read input from STDIN. Print output to STDOUT */return0;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
nCr table
You are viewing a single comment's thread. Return to all comments →
hello..... C++ user, Apke liye...