something wrong to uri 1478 solution

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rakibul
    New Member
    • Jul 2018
    • 1

    something wrong to uri 1478 solution

    I am new at python...I write this code. This is a uri problem and problem no 1478.Here the uri problem link:https://www.urionlinejudge.com.br/ju...lems/view/1478
    My code:
    Code:
    while(1):
        N=int(input())
        if(N==0):
            break
        
        mainlist=[]
        for i in range(0,N):
            sublist=[]
            for j in range(0,N):
                sublist.append(9)
            mainlist.append(sublist)
            
        print(mainlist)
    
        a=0
        b=N
        c=0
        d=N-1
        k=1
        for j in range(0,N):
            for i in range(a,b):
                mainlist[c][i]=i+k
                mainlist[i][c]=i+k
                mainlist[d][N-1-i]=i+k
                mainlist[N-1-i][d]=i+k
    
            a+=1
            b-=1
            c+=1
            d-=1
            k-=1
    
        for i in range(0,N):
            for j in range(0,N-1):
                print(" ",mainlist[i][j],end=" ")
            print(" ",mainlist[i][N-1])
        print("")
    but when i submit this on uri...showing something error.and couldnt found this.Please anyone help me to fine the error of my code.
    Last edited by Rabbit; Jul 9 '18, 03:38 PM. Reason: Please use code tags when posting code or formatted data
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Please use code tags when posting code or formatted data.

    Did you try running your code to see if the output matches? Because it doesn't. Your code prints out extra stuff that it's not looking for. Specifically arrays filled with a bunch of 9s.

    Comment

    Working...