Advertisement
konchin_shih

0817 test

Aug 17th, 2021
1,220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1.  
  2. table = [
  3.     [1, 2, 3],
  4.     [2, 4, 3],
  5.     [4, 3, 9]
  6. ]
  7.  
  8.  
  9. def f(n, x, y):
  10.     maxn = -1
  11.     for i in range(-n, n + 1):
  12.         for j in range(-n, n + 1):
  13.             cur = table[x + i][y + j]
  14.             if maxn < cur:
  15.                 maxn = cur
  16.                 maxp = [x + i, y + j]
  17.     return (maxn, maxp)
  18.  
  19.  
  20. print(f(1, 1, 1))
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement