爪哇皇后碰撞
我正在解决一个皇后碰撞问题,可以定位here
我只是需要一些帮助来理解说明。我能读懂文件,但我不明白的是我怎么知道女王的位置在哪里
我不明白这部分:
数据集的第一行包含空格分隔的正整数n g,其中n表示n x n板大小,g表示要描述的皇后的线性模式数,其中n<;30000和g<;250.接下来的g行各包含五个空白分隔整数,k x y s t,表示位置(x+i*s,y+i*t)处k个皇后的线性模式,对于i=0,1。。。,k-1。k的值为正。如果k是1,那么s和t的值是无关的,它们将被给出为0。所有女王职位都将在董事会上。所有线性模式中的皇后位置总数将不超过n,并且所有这些皇后位置将是不同的
# 1 楼答案
你读第一行的
g
,它会告诉你还有多少行。在每一行上,你读k
、x
、y
、s
和t
,并用它们来定位一些皇后k
告诉你这个集合要放置多少个皇后,x
和y
告诉你第一个皇后的位置,以及s
和t
告诉你皇后之间的距离。我不觉得这有什么难懂的