thespeedracer38

DAY-1

Jan 12th, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. nk = input().split()
  2. n = int(nk[0])
  3. k = int(nk[1])
  4.  
  5. chapters = []
  6.  
  7. for i in range(n):
  8.     chapters.append(int(input()))
  9.  
  10. canRead = True    
  11.  
  12. front = 0
  13. rear = n - 1
  14.  
  15. while canRead:
  16.     canRead = False
  17.    
  18.     if chapters[front] <= k:
  19.         n = n - 1
  20.         front += 1
  21.         canRead = True
  22.    
  23.     if chapters[rear] <= k:
  24.         n = n - 1
  25.         rear -= 1
  26.         canRead = True
  27.  
  28. print(n)
Add Comment
Please, Sign In to add comment