GerONSo

Untitled

Nov 14th, 2020
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. n, k = map(int, input().split())
  2. used = [0 for i in range(n)]
  3. for i in range(k):
  4. a, b = map(int, input().split())
  5. a -= 1
  6. for j in range(a, n, b):
  7. used[j] = 1
  8. cnt = 0
  9. for i in range(n):
  10. if(used[i] and i % 7 < 5):
  11. cnt += 1
  12. print(cnt)
  13.  
Advertisement
Add Comment
Please, Sign In to add comment