Fork me on GitHub

teddy online judge

teddy es un oso de peluche

506. Patterns and Pictures

Limite de tiempo : 1 seg.   Total runs : 0  Aceptados : 0

Fabrics often have repeating patterns on them, such as a tessellation of carrots and bats.

A given image, such as a carrot in the above example, takes up a certain number of square inches on the fabric. In addition, a piece of fabric with more than one image will have those images in some sort of simple integral ratio, such as 3 carrots for every 2 bats. One instance of images in the given ratio is considered a full set.

Fabrics are sold by the square yard (and, for those of you who have forgotten, there are 36 inches to the yard). Given a collection of images, their sizes, and the ratios in which they occur, what is the maximum number of full sets that could possibly appear on one, two, and three square yards of patterned fabric?

(Note that this maximum implies totally arbitrary shapes and placements for the images, which may be different for the three lengths of fabric; the particulars of the layout are irrelevant for the purposes of the problem.)

Sample Input/Output

15 3
17 2
16 32 49

Hecho por Alan Gonzalez @_alanboy ; Concepto Luis Hector Chavez @lhchavez ; Infraestructura por Instituto Tecnologico de Celaya

contribuciones de los usuarios bajo la licencia cc-wiki con atribucion requerida