Skip to content

Instantly share code, notes, and snippets.

@zarc1411
Created February 8, 2020 06:14
Show Gist options
  • Save zarc1411/743a86f700ae6ba6ae3c6963d2783cc2 to your computer and use it in GitHub Desktop.
Save zarc1411/743a86f700ae6ba6ae3c6963d2783cc2 to your computer and use it in GitHub Desktop.
#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