k_vychodilova

peklo 3

Oct 21st, 2020
972
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import numpy as np
  2. i = 1
  3. j = 0
  4.  
  5. matice = np.array([[1, 0, 2],
  6.                 [2, 5, 6],
  7.                 [1, 6, 9]])
  8. M = matice.shape[0]     # radky
  9. N = matice.shape[1]   # sloupce
  10. p = 0
  11.  
  12. konec_sloupcu = False
  13. while not konec_sloupcu:
  14.     Q = True
  15.     konec_radku = False
  16.  
  17.     i = 1 # bez tohoto to nefunguje a není to v diagramu
  18.     while not konec_radku:
  19.         if not matice[i][j] > matice[i-1][j]:
  20.             Q = False
  21.         i += 1
  22.         konec_radku = (i == M)
  23.     if Q == False:
  24.         p += 1
  25.     j += 1
  26.     konec_sloupcu = (j == N)
  27. print(p)
RAW Paste Data