Skip to content

Instantly share code, notes, and snippets.

@haridutt12
Created October 15, 2016 06:08
Show Gist options
  • Save haridutt12/673218552a64f5c9409465a0a7b9a80f to your computer and use it in GitHub Desktop.
Save haridutt12/673218552a64f5c9409465a0a7b9a80f to your computer and use it in GitHub Desktop.
#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