HBC16638carpet题解

季陌殇 算法基础篇 72 0
题库丰富多样,涵盖各个领域,全网最全C++题库,让您在练习中不断成长!
White Cloud has a rectangle carpet of nmn*mnm. Grid(i,j)Grid (i,j)Grid(i,j) has a color colorA[i][j]colorA[i][j]colorA[i][j] and a cost costA[i][j]costA[i][j]costA[i][j]. White Rabbit will choose a su

White Cloud has a rectangle carpet of n∗mn*mn∗m. Grid(i,j)Grid (i,j)Grid(i,j) has a color colorA[i][j]colorA[i][j]colorA[i][j] and a cost costA[i][j]costA[i][j]costA[i][j]. White Rabbit will choose a subrectangle BBB of p∗qp*qp∗q from AAA and the color of each grid is colorB[0...p−1][0...q−1]colorB[0...p-1][0...q-1]colorB[0...p−1][0...q−1], the cost of BBB is the (maximum number in the corresponding subrectangle of costA∗(p+1)∗(q+1)costA*(p+1)*(q+1)costA∗(p+1)∗(q+1)). Then colorBcolorBcolorB is continuously translated and copied in an infinite times, that is, expand colorBcolorBcolorB into an infinite new matrix, colorCcolorCcolorC, which satisfies colorC[i][j]=colorB[imodp][jmodq]colorC[i][j]=colorB[i mod p][j mod q]colorC[i][j]=colorB[imodp][jmodq]. White Rabbit must ensure that colorAcolorAcolorA is a subrectangle of colorCcolorCcolorC. You need to find the minimum cost way.

HBC16638carpet题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断挑战自我,才能突破极限!全网最全C++题库,让您在编程道路上越走越远。

标签: HBC16638carpet题解