You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
541 B
25 lines
541 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
const int N = 110;
|
|
|
|
int a[N][N];
|
|
int cnt, j, n = 10;
|
|
|
|
|
|
int main() {
|
|
a[0][n] = 1;
|
|
for (cnt = 1; cnt < n; cnt++)
|
|
for (j = (n - cnt); j <= (n + cnt); j = j + 2)
|
|
a[cnt][j] = a[cnt - 1][j - 1] + a[cnt - 1][j + 1];
|
|
|
|
for (cnt = 0; cnt < n; cnt++) {
|
|
for (j = 0; j < 2 * n + 1; j++)
|
|
if (a[cnt][j] == 0)
|
|
cout << " ";
|
|
else
|
|
cout << a[cnt][j];
|
|
cout << endl;
|
|
}
|
|
return 0;
|
|
} |