Back

P5461赦免战俘

P5461 赦免战俘

心态小裂,写了n遍,最后发现循环里忘加x,y了

a = int(input())
b = [[1 for i in range(2**a)] for j in range(2**a)]
l = 2**a
def func(l,x,y):
    if l == 1 :
        return 

    for i in range(x,x+int(l/2)) :
        for j in range(y,y+int(l/2)) :
            b[i][j] = 0
    
    func(int(l/2),x+int(l/2),y)
    func(int(l/2),x,y+int(l/2))
    func(int(l/2),x+int(l/2),y+int(l/2))

func(l,0,0)
for i in range(2**a):
    for j in range(2**a):
        print(b[i][j],end=" ")
    print()
Built with Hugo
Theme Stack designed by Jimmy
© Licensed Under CC BY-NC-SA 4.0