Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <algorithm>
- #define N 105
- using namespace std;
- ifstream fin(".in");
- ofstream fout(".out");
- int a[N][N], n;
- int main()
- {
- int i, j;
- cin>>n;
- for(i=n;i>=1;i--)
- for(j=1;j<=n;j++)
- if(i==n) a[i][j]=n;
- else if(j==1)a[i][j]=i;
- else a[i][j]=a[i+1][j-1]+a[i][j-1];
- for(i=1;i<=n;i++, cout<<"\n")
- for(j=1;j<=n;j++)
- cout<<a[i][j]<<" ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement