MANGOJCE - Editorial

PROBLEM LINK:

Practice
Contest : CodeShake

Author: Amruta Patil
Tester: Amruta Patil
Editorialist: Amruta Patil

DIFFICULTY:

EASY

PREREQUISITES:

Basic Math

PROBLEM:

In a Juice center there are some mangoes kept in a basket. The basket contains both small size mangoes and large size mangoes. If a juice seller wants to prepare a glass of juice he has to either use one large size mango or two small size mangoes. If a basket contains M large mangoes and N small size mangoes, how many glasses of mango juice can be prepared?

QUICK EXPLANATION:

A juice center contains some mangoes, there are M large size mangoes and N small size mangoes. A glass of juice can be prepared either by one large size mango or two small size mangoes. Then, how many glass of juice can be prepared with M large size and N small size mangoes.

Consider for example, if there are 12 large size mangoes and 13 small size mangoes.
Then, total no of glasses of juice that can be prepared is 12+ 13/2 =18.

SOLUTIONS:

Setter's Solution
#include <stdio.h>
int main()
{
    int t,m,n,i;
    scanf("%d",&t);
    for(i=0;i<t;i++){
        scanf("%d %d",&m,&n);
        printf("%d\n", m+(n/2));
    }
    return 0;
}