You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
435 B
C++

#include <cstdio>
long long a[31][31];
int main()
{
a[1][1] = 1;
for (int i = 2; i <= 30; i++)
for (int j = 1; j <= 30; j++)
a[i][j] = a[i - 1][j - 1] + a[i - 1][j];
int x;
while (~scanf("%d", &x))
{
for (int i = 1; i <= x; i++)
for (int j = 1; j <= i; j++)
printf("%d%c", a[i][j], " \n"[j == i]);
putchar('\n');
}
return 0;
}