Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int A[2005][2005];
- void Newton(int n, int k)
- {
- if(n==0 || n==k)
- {
- cout<<1;
- return;
- }
- if(k==1 || k==n-1)
- {
- cout<<n;
- return;
- }
- A[0][0]=1;
- for(int i=1; i<=n+1; i++)
- {
- A[i][0]=1;
- for(int j=1; j<i; j++)
- {
- A[i][j]=A[i-1][j]+A[i-1][j-1]%10000;
- }
- }
- cout<<A[n+1][k]%10000;
- }
- int main()
- {
- int n,k;
- cin>>n>>k;
- Newton(n,k);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement