Created
October 15, 2016 06:08
-
-
Save haridutt12/673218552a64f5c9409465a0a7b9a80f 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 <iostream> | |
using namespace std; | |
int main() { | |
int n; | |
cin>>n; | |
while(n>0) | |
{ long int g; | |
cin>>g; | |
while(g>0) | |
{ | |
int i,q; | |
long r; | |
cin>>i>>r>>q; | |
if(r%2==0) | |
{ | |
cout<<r/2<<endl; | |
} | |
else{ | |
if(i==q) | |
{ | |
cout<<r/2<<endl; | |
} | |
else | |
{ | |
cout<<r/2+1<<endl; | |
} | |
} | |
g--; | |
} | |
n--; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment