666

王峻谦  •  4个月前


include

using namespace std;

int main() {

int a[40][40];
int n;
cin >> n;
for (int b = 0; b <= 35; b++) {
	for (int c = 0; c <= 35; c++) {
		a[b][c] = 0;
	}
}
a[1][1] = 1;
for (int b = 2; b <= n; b++) {
	for (int c = 1; c <= b; c++) {
		a[b][c] = a[b - 1][c] + a[b - 1][c - 1];
	}
}
for (int b = 1; b <= n; b++) {
	for (int c = 1; c <= b; c++) {
		printf("%d ", a[b][c]);
	}
	printf("\n");
}
return 0;

}


评论:

请先登录,才能进行评论