Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- //
- #define ll long long
- #define ull unsigned long long
- #define pb push_back
- #define mx 100010
- #define mod 1000000007
- #define inf INT_MAX
- #define pi acos(-1)
- #define endl '\n'
- #define fin freopen("input", "r", stdin)
- #define Fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
- //
- int main() {
- ll n;
- cin >> n;
- ll ar[n][2 * n - 1];
- for (ll i = 0; i < n; i++) {
- ll x = n - i - 1, y = 0;
- while (y < x) { cout << ' '; y++; }
- y = x + i * 2;
- for (ll j = x; j <= y; j += 2) {
- if (j == x || j == y) ar[i][j] = 1;
- else ar[i][j] = ar[i - 1][j - 1] + ar[i - 1][j + 1];
- cout << ar[i][j] << ' ';
- }
- cout << endl;
- }
- }
Add Comment
Please, Sign In to add comment