#D. 杨辉三角

    Type: Default 2000ms 256MiB

杨辉三角

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

给出 n(1n100)n(1\le n\le100),输出杨辉三角的前 nn 行。

输入格式

一个整数。

输出格式

杨辉三角形,两个数之间用一个空格隔开,不需要其他更复杂的对齐。

输入输出样例 #1

输入 #1

6

输出 #1

1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1

提示

在Python中,print()函数默认会在输出的结尾添加换行符(\n),但有时我们需要在结尾添加空格而不是换行符。 print()函数有一个end参数,默认值是'\n',我们可以修改它来添加空格:

print("Hello", end=' ')  # 输出: Hello 
print("World")          # 输出: World (会接在上一个输出后面)

2025春人工智能数学原理与算法Python基础作业

Not Claimed
Status
Done
Problem
4
Open Since
2025-4-3 0:00
Deadline
2025-4-11 23:59
Extension
24 hour(s)