Created
February 8, 2020 06:14
-
-
Save zarc1411/743a86f700ae6ba6ae3c6963d2783cc2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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