100 Accepted
# | 状态 分数 | 耗时 | 内存占用 |
---|---|---|---|
#1 | Accepted 10 | 35ms | 4 MiB |
#2 | Accepted 10 | 35ms | 3.8 MiB |
#3 | Accepted 10 | 34ms | 4 MiB |
#4 | Accepted 10 | 34ms | 3.8 MiB |
#5 | Accepted 10 | 35ms | 4 MiB |
#6 | Accepted 10 | 34ms | 3.8 MiB |
#7 | Accepted 10 | 34ms | 3.8 MiB |
#8 | Accepted 10 | 34ms | 3.8 MiB |
#9 | Accepted 10 | 34ms | 4.1 MiB |
#10 | Accepted 10 | 34ms | 3.8 MiB |
代码
n = int(input())
nom = [[0]*n for _ in range(n)]
for i in range(n):
nom[-1][i] = (i+1)**2
for j in range(n-2,-1,-1):
k = n-j-1
for h in range(n):
if k-1>=h:
nom[j][h] = k**2+1+h
else:
nom[j][h]= nom[j+1][h]-1
for row in nom:
print(''.join(f"{num:4}" for num in row))
信息
- 递交者
- 题目
- P369 练63.3 迂回方阵
- 语言
- Python3
- 代码长度
- 334 Bytes
- 递交时间
- 2025-3-24 22:03:30
- 评测时间
- 2025-3-24 22:03:31
- 分数
- 100
- 总耗时
- 345ms
- 峰值时间
- 35ms
- 峰值内存
- 4.1 MiB