Cod sursa(job #127849)

Utilizator MegaheroDan Cearnau Megahero Data 25 ianuarie 2008 10:50:47
Problema Fructe Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.5 kb
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
long int t;
void citire()
{
freopen("fructe.in","r",stdin);
freopen("fructe.out","w",stdout);
scanf("%ld",&t);
}


int mancare(int a,int b)
{
   if (b%2==0)
   	{
   	a+=b/2;
   	return 0;
      }
   else
   	{
      a+=(b-1)/2;
		return 1;
      }
}


int main()
{
int x,y,q;
citire();
while (t)
	{
   t--;
	scanf("%ld",&x);
	scanf("%ld",&y);
	q=mancare(x,y);
   printf("%ld\n",q);
   }
return 0;
}