Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. def check(pict, k):
  2. # @param pict : picture
  3. # @param k : int
  4. # @return bool
  5.   width=getWidth(pict)
  6.   height=getHeight(pict)
  7.   return exist(pict, width, height, k)
  8.    
  9. def checkRow(pict, D1, y, k):
  10. # @param pict : Picture
  11. # @param D1: int (width)
  12. # @param y: pixel (height)
  13. # @param k : int
  14. # @return bool
  15.   r=0
  16.   for x in range(0, D1):
  17.     px=getPixel(pict, x, y)
  18.     r=r+getRed(px)
  19.   return r == k
  20.  
  21. def exist(pict, D1, D2, k) :
  22. # @param pict : Picture
  23. # @param D1 : int (width)
  24. # @param D2 : int (height)
  25. # @param k : int
  26. # @return bool
  27.   for y in range(0, D2):
  28.     if checkRow(pict, D1, y, k) == True :
  29.       return True
  30.   return False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement