Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- N, K = map(int, input().split())
- d = [0]*(N+1)
- arr = []
- n = N+1
- for i in range(K):
- arr.append(list(map(int, input().split())))
- d[arr[-1][0]] = 1
- r = 0
- for i in range(len(d)):
- if(d[i]):
- if(i%7!=6 and i%7!=0):
- r += 1
- for j in arr:
- if(i == j[0]):
- j[0] += j[1]
- if(j[0] <= N):
- d[j[0]] = 1
- print(r)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement