1 条题解

  • 0
    @ 2023-6-11 12:16:45

    Python :

    n = int(input())
    a = input()
    if(a == "x"):
        for i in range(1, n + 1):
            print(" " * (n - i), end="")
            for j in range(1, i + 1):
                print("*", end="")
            for m in range(1, i):
                print("*", end="")
            print()
        for i in range(n, 0, -1):
            print(" " * (n - i), end="")
            for j in range(i, 0, -1):
                print("*", end="")
            for m in range(i - 1, 0, -1):
                print("*", end="")
            print()
    if(a == "y"):
        for i in range(1, n + 1):
            print(" " * (n - i), end="")
            for j in range(1, i + 1):
                print("*", end="")
            for m in range(1, i):
                print("*", end="")
            print(" " * ((n - i) * 2), end="")
            for h in range(1, i + 1):
                print("*", end="")
            for l in range(1, i):
                print("*", end="")
            print()
    
    • 1

    信息

    ID
    2273
    时间
    1000ms
    内存
    16MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者