当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2807:Bingo!

题目描述
Bingo is a game in which players try to form patterns on a 5 x 5 grid (or card). Each column on the card is represented by a letter in the game's namesake: B, I, N, G, or O. Each square on the grid contains a number. Players mark numbers as they are chosen randomly until a person has a card with a winning pattern marked (or bingo). An exception to this is the center square in the grid, which is a free spot and is already marked for all players at the beginning of each game. The possible numbers called are 1-75, inclusive, with each set of fifteen numbers corresponding to a letter: B for 1-15, I for 16-30, N for 31-45, G for 46-60, and O for 61-75.

Given the amount of numbers for each letter already called and information used to determine the set of winning patterns, write a program to determine the fewest amount of numbers that still need to be called for a possible bingo.

输入解释
Input to this problem will begin with a line containing a single integer n indicating the number of data sets. The first line in each data set will be in the format B I N G O X Y where:
  1. B is the amount of numbers in the B category that have already been called;
  2. I is the amount of numbers in the I category that have already been called;
  3. N is the amount of numbers in the N category that have already been called;
  4. G is the amount of numbers in the G category that have already been called;
  5. O is the amount of numbers in the O category that have already been called;
  6. X (where 1 <= X <= 19) is the number of input patterns (the winning patterns are described through combinations of the input patterns);
  7. and Y (where 1 <= Y <= minimum (5, X)) is the minimum number of input patterns that must be combined to form a winning pattern.
The next 5 lines in each data set will be a series of 5 x 5 grids of the input patterns in a format where X represents a square that must be marked and O represents a square that does not have to be marked. Using the input patterns and Y given above, the entire set of winning patterns can be determined.
For example, given an X of 4, a Y of 2, and a set of input patterns as follows:
XXOOO OOOXX OOOOO OOOOO

XXOOO OOOXX OOOOO OOOOO
OOOOO OOOOO OOOOO OOOOO
OOOOO OOOOO XXOOO OOOXX
OOOOO OOOOO XXOOO OOOXX
the set of winning patterns (of which only one must be marked to have a bingo) is:
XXOXX XXOOO XXOOO OOOXX OOOXX OOOOO

XXOXX XXOOO XXOOO OOOXX OOOXX OOOOO
OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO
OOOOO XXOOO OOOXX XXOOO OOOXX XXOXX
OOOOO XXOOO OOOXX XXOOO OOOXX XXOXX


输出解释
For each data set, output a single line containing the fewest amount of numbers that still need to be called to form a bingo.

输入样例
3
0 1 0 2 1 4 2
XXOOO OOOXX OOOOO OOOOO
XXOOO OOOXX OOOOO OOOOO
OOOOO OOOOO OOOOO OOOOO
OOOOO OOOOO XXOOO OOOXX
OOOOO OOOOO XXOOO OOOXX
1 1 0 1 1 5 1
XXXXX OOOOO OOOOO OOOOO OOOOO
OOOOO XXXXX OOOOO OOOOO OOOOO
OOOOO OOOOO XXXXX OOOOO OOOOO
OOOOO OOOOO OOOOO XXXXX OOOOO
OOOOO OOOOO OOOOO OOOOO XXXXX
15 15 15 15 4 1 1
XXXXX
XXXXX
XXXXX
XXXXX
XXXXX

输出样例
4
0
1


该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 South Central USA 2005

源链接: POJ-2807

最后修改于 2020-10-29T06:44:51+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536