题解 | #圣诞树#
圣诞树
http://www.nowcoder.com/practice/9a03096ed8ab449e9b10b0466de29eb2
m=int(input())
n=3*m-2
if m==1:
for i in range(1,n+3):
print(' '*(n+2-i)+i*'* ')
for i in range(m):
print(' '*(3*m-1)+'*')
else:
for i in range(1,n+3):
if i in [3*i-2 for i in range(2,m+1)]:
print(' '*(n+2-i)+(int((i+2)/3))*'* ')
elif i in [3*i-1 for i in range(2,m+1)]:
print(' '*(n+2-i)+(int((i+1)/3))*'* * ')
else:
print(' '*(n+2-i)+i*'* ')
for i in range(m):
print(' '*(3*m-1)+'*')