click below for solution

Wednesday, 9 February 2022

Chef and his Fruit solution|Codesheff



Chef has closed his restaurant and decided to run a fruit stand instead. His signature dish is a fruit chaat consisting of 2 bananas and 1 apple. He currently has X bananas and Y apples. How many chaats can he make with the fruits he currently has?

Input Format

  • The first line will contain T, the number of testcases. Then the testcases follow.
  • Each testcase consists of a single line containing two space separated integers - X and Y

Output Format

For each testcase, output the answer on a new line.

Constraints

  • 1T100
  • 0X,Y100

Sample Input 1 

3
72 50
38 93
51 4

Sample Output 1 

36
19
4

Explanation

Test Case 1: Chef can make 36 chaats using 72 bananas and 36 apples.

Test Case 2: Chef can make 19 chaats using 38 bananas and 19 apples.

Test Case 3: Chef can make 4 chaats using 8 bananas and 4 apples.

Solution: 

Click here for solution

No comments:

Post a Comment