Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
scanf("%d" , &t);
while(t--)
{
int g;
scanf("%d" , &g);
while(g--)
{
int i,n,q;
scanf("%d %d %d" , &i , &n , &q);
int c = 0;
if(n%2==0)
c = n/2;
else
c = n/2 + 1;
int cnt1 = n-c;
int cnt2 = n-cnt1;
if(i == q)
printf("%d\n" , cnt1);
else
printf("%d\n" , cnt2);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment