Advertisement
davide1409

diagNum45

Dec 24th, 2019
372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. def diagNum45(m,x,y):
  2. #@param m: matrice di interi
  3. #@param x: int
  4. #@param y: int
  5.   w = len(m[0])-1
  6.   h = len(m)-1
  7.   if x<0 or x>=h or y<0 or y>=w:
  8.     return
  9.    
  10.   else:
  11.     iter = min(w-y,h-x)
  12.     m[x][y] = 0
  13.     for i in range(iter):
  14.       x+=1
  15.       y+=1
  16.       m[x][y] = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement