Guys, I have checked this question solutions everyone is doing same ((x+y)/k)%2==0

checking this condition but i am to able to understand why, please tell me

link of question is PAJAPONG Problem - CodeChef

Which part don’t you understand? X + Y is the total sum of moves, \left \lfloor \dfrac{X + Y}{K} \right \rfloor is the number of times the server has changed, so \left \lfloor \dfrac{X + Y}{K} \right \rfloor \mod 2 will be 1 iff the server is Paja.

Hope this help!

```
for _ in range(int(input())):
x,y,k=map(int, input().split())
#fin total score
total_score=x+y
#find how many services are done yet
service_changed_yet=total_score//k
#if service yet are even then next service of chef else paja
if(service_changed_yet%2==0):
print("Chef")
else:
print("Paja")
```

1 Like