Skip to content

Instantly share code, notes, and snippets.

@gauravkoradiya
Created April 26, 2020 08:07
Show Gist options
  • Save gauravkoradiya/c87958e5a33880874ae8a58cec17fb88 to your computer and use it in GitHub Desktop.
Save gauravkoradiya/c87958e5a33880874ae8a58cec17fb88 to your computer and use it in GitHub Desktop.
Codechef_DSA01 - CONFLIP
# https://www.codechef.com/LRNDSA01/problems/CONFLIP
import math
def main():
for _ in range(int(input())):
for _ in range(int(input())):
I,N,Q = map(int, input().split())
if I == Q:
print(math.floor(N/2))
else:
print(math.ceil(N/2))
# I = next(ip) % 2
# N = next(ip)
# Q = next(ip) % 2
# print(list(filter(lambda x : ((x+I) % 2) == Q ,range(N,0,-1))).__len__())
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment