import time
time_start=time.time()
n,char=input().split()
n =int(n)print(char*n)if n %2==0:
row = n //2-2else:
row = n //2-1for i inrange(row):print(char,' '*(n-4),char)print(char*n)
time_end=time.time()print('time cost',time_end-time_start,'ms')
打印沙漏
import time
time_start=time.time()import math
n,char=input().split()
n =int(n)
bottom =int(math.sqrt(2*(n+1))-1)if bottom %2==0:
bottom -=1
d = bottom
print(char*bottom)while d !=1:
d = d -2
block =(bottom - d)//2-1print(' '*block,char*d)
d =1while d != bottom -2:
d = d +2
block =(bottom - d)//2-1print(' '*block,char*d)print(char*bottom)
m =(bottom +1)**2/2-1print(int(n-m))
time_end=time.time()print('time cost',time_end-time_start,'ms')
Hello World for U
import time
time_start=time.time()
char =input()
n =len(char)
n1 =(n +2)//3-1
n2 = n - n1 *2
block = n2 -4for i inrange(n1):print(char[i],' '*block,char[-(i+1)])print(char[n1:n1+n2])
time_end=time.time()print('time cost',time_end-time_start,'ms')