I am solving a Queen collision problem that can be located here
I just need some help understanding the instructions. I understand reading from file, but what I don't understand is how do i know where the 开发者_高级运维queen positions are?
I don't understand this part:
The first line of a dataset contains blank separated positive integers n g, where n indicates an n x n board size, and g is the number of linear patterns of queens to be described, where n < 30000, and g < 250. The next g lines each contain five blank separated integers, k x y s t, representing a linear pattern of k queens at locations (x + i*s, y +i*t), for i = 0, 1, ..., k-1. The value of k is positive. If k is 1, then the values of s and t are irrelevant, and they will be given as 0. All queen positions will be on the board. The total number of queen positions among all the linear patterns will be no more than n, and all these queen positions will be distinct.
The first line of a dataset contains blank separated positive integers n g, where n indicates an n x n board size, and g is the number of linear patterns of queens to be described, where n < 30000, and g < 250. The next g lines each contain five blank separated integers, k x y s t, representing a linear pattern of k queens at locations (x + i*s, y +i*t), for i = 0, 1, ..., k-1. The value of k is positive. If k is 1, then the values of s and t are irrelevant, and they will be given as 0. All queen positions will be on the board. The total number of queen positions among all the linear patterns will be no more than n, and all these queen positions will be distinct.
You read g
on the first line, and it tells you how many more lines there are. On each of those lines, you read k
, x
, y
, s
and t
, and use those to position some queens. k
tells you how many queens to position for this set, x
and y
tell you where to position the first one, and s
and t
tell you the distance between the queens. I don't see how there's anything difficult to understand about this.
精彩评论