Programming contests

ACM ICPC programozó csapatverseny, házi forduló, 2016. október 15.

October 15, 2016, 10:00 AM – October 15, 2016, 3:00 PM

Donation Packaging

ICPC donation center is preparing donation packages for people who faced disaster in all areas of Thailand. The center gets several kinds of donation. This year, the center gets a request to pack the basic items in one package containing three sets. The first set, called SetA, is water and beverage. The second one, SetB, consists of instant noodle, canned food, and rice. And the last set, SetC, is first-aid kits and tissue paper. Every day, we try to pack and distribute as many donation packages as possible. We have constraints for packaging, which are: each package must contain elements of SetA, SetB, and SetC equally, and one distribution must contain a minimum of 30 packages. However, the center receives elements of these 3 sets in different amount each day. Therefore, the center must wait until the accumulated amount of elements of each and every set reaches 30 in order to pack a distribution.

Input Specification

The input will start with an integer T (1 ≤ T ≤ 365), the number of consecutive donation days. The next T lines show donations in each day, consisting of three integers: the number of elements of SetA, SetB, and SetC, respectively.

Output Specification

For each day, print out the maximum number of packages to be distributed that day. If the packages cannot be distributed that day (the number of packages is less than 30), print “NO”.

Sample Input

  1. 5
  2. 20 30 60
  3. 20 30 60
  4. 50 40 60
  5. 50 10 10
  6. 0 50 50
download as text file

Output for Sample Input

  1. NO
  2. 40
  3. 50
  4. NO
  5. 50
download as text file
University of Debrecen; Faculty of Informatics; v. 09/30/2024