Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def parse_args():
- nk = list(map(int, input().split(' ')))
- return nk[0], nk[1]
- def modify(arr, tmp, n):
- for i in range(0, n):
- if arr[i]:
- ip = (i + 1) % n
- im = (i + n - 1) % n
- tmp[ip] = 1
- tmp[im] = 1
- for i in range(0, n):
- arr[i] = tmp[i]
- tmp[i] = 0
- return arr
- if __name__ == "__main__":
- n, k = parse_args()
- arr = [1] + [0] * (n - 1)
- tmp = [0] * n
- for k in range(0, k):
- # print(list(map(int, arr)))
- arr = modify(arr, tmp, n)
- # print(list(map(int, brr)))
- m = sum(map(int, arr))
- print(m)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement