Oz's paintings

3.8

434 votes
Ad-Hoc, Combinatorics, Easy, Ready, Mathematics, Approved
Problem

Today Oz wants to make some money through his paintings. For painting, Oz has X white color pens, Y red color pens and Z green color pens. Their are 4 types of paintings he wants to make i.e.

  • First kind of painting needs 3 white color pens.
  • Second kind of painting needs 3 red color pens.
  • Third kind of painting needs 3 green color pens.
  • Fourth kind of painting needs 1 white, 1 red and 1 green color pen.

Oz wants to earn more money so he wants to make maximum number of paintings. Help Oz to find the maximum number of paintings he can make.

Input :
The first line contains the number of test cases T. Each test case consists of 3 integers X, Y and Z — the number of white, red and green color pens.

Output :
For each test case print the maximum number of paintings Oz can make.

Constraint :
1 ≤ T ≤ 10
0 ≤ X, Y, Z ≤ 109

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Oz can make 1 first kind, 1 second kind, 1 third kind and 1 fourth kind painting

Editor Image

?