题目描述
无文字描述,看实例写代码
eg1:
Input | Output |
---|---|
1 | 1 |
eg2:
Input | Output |
---|---|
2 | 2 22 |
eg3:
Input | Output |
---|---|
3 | 3 33 333 |
eg3:
Input | Output |
---|---|
3 | 3 33 333<> |
eg4:
Input | Output |
---|---|
4 | 4 44 444 4444 |
eg5:
Input | Output |
---|---|
5 | 5 55 555 5555 55555 |
题目分析
题目要求我们生成一个三角形。
解题代码
想了半天,我最终还是没有写出来,下面是瑞典老哥的代码:
import sys
import math
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
n = int(input())
for i in range(1,n+1):
print(str(n)*i)
印度阿三的代码:
import sys
import math
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
n = int(input())
# Write an answer using print
# To debug: print("Debug messages...", file=sys.stderr, flush=True)
for i in range(1,n+1):
for j in range(i):
print(n,end='')
print()