Untitled
unknown
plain_text
3 years ago
920 B
2
Indexable
Never
def ccsp(m,n,outarr): k=0 l=0 cnt=0 total=m*n while(k<m and l<n): if(cnt==total): break for i in range(k,m): print(outarr[i][l],end=",") cnt+=1 l+=1 if(cnt==total): break for i in range(l,n): print(outarr[m-1][i],end=",") cnt+=1 m-=1 if(cnt==total): break if(k<m): for i in range(m-1,k-1,-1): print(outarr[i][n-1],end=",") cnt+=1 n-=1 if(cnt==total): break if(l<n): for i in range(n-1,l-1,-1): print(outarr[k][i],end=",") cnt+=1 k+=1 def main(): m=int(input()) outarr=[] for i in range(m): outarr.append(list(map(int,input().split()))) ccsp(m,len(outarr[0]),outarr) main()