Bingo |
The game of BINGO is another of the great American pastimes. Our
version of BINGO is to be played on a square card containing a 5 matrix.
The first five lines of the input file will each contain five integer values
separated by spaces in the range
; these values are to be placed
in the corresponding row of the matrix from left to right. Immediately
following the values for the card will be a series of lines each
containing one ``called" number such that
; the last line will
contain an invalid ``called" number of zero (0).
For this problem, you are to write a program that accepts the integers that are to be placed in the cells of a ``BINGO" card. Then you are to read in the ``called" values, which may or may not be the same as the numbers on your BINGO card, one at a time until you either find a BINGO, or you run out of called numbers.
A BINGO occurs when one of the following rules has been fulfilled:
Any element in the matrix containing a zero (0) after the original load is FREE, and is considered to have been matched.
If you run out of called numbers before you find a BINGO, you are to print out the following message immediately following the last valid ``called" number:
No BINGO on this card.
If you find a BINGO at some point in the input, you are to stop reading the input values, and print out a notification of the BINGO followed by a list of comma separated triples in ROW MAJOR Order that represent the Row, Column, and Value of all of the elements making up the BINGO. The output should have the following format:
BINGO
R, C, V
R, C, V
...
Where:
R = row subscript from 1 to 5, and
C = column subscript from 1 to 5, and
V = called number value that matched the cell contents, or the word FREE.