TOJ 2997: City Game
2997: City Game
묘사
Bob is a strategy game programming specialist. In his new city building game the gaming environment is as follows: a city is built up by areas, in which there are streets, trees,factories and buildings. There is still some space in the area that is unoccupied. The strategic task of his game is to win as much rent money from these free spaces. To win rent money you must erect buildings, that can only be rectangular, as long and wide as you can. Bob is trying to find a way to build the biggest possible building in each area. But he comes across some problems �C he is not allowed to destroy already existing buildings, trees, factories and streets in the area he is building in.
Each area has its width and length. The area is divided into a grid of equal square units.The rent paid for each unit on which you're building stands is 3$.
Your task is to help Bob solve this problem. The whole city is divided into K areas. Each one of the areas is rectangular and has a different grid size with its own length M and width N.The existing occupied units are marked with the symbol R. The unoccupied units are marked with the symbol F.
입력
The first line of the input contains an integer K ?C determining the number of datasets. Next lines contain the area descriptions. One description is defined in the following way: The first line contains two integers-area length M<=1000 and width N<=1000, separated by a blank space. The next M lines contain N symbols that mark the reserved or free grid units,separated by a blank space. The symbols used are: R ?C reserved unit F ?C free unit In the end of each area description there is a separating line.
출력
For each data set in the input print on a separate line, on the standard output, the integer that represents the profit obtained by erecting the largest building in the area encoded by the data set.
샘플 입력
2 5 6 R F F F F F F F F F F F R R R F F F F F F F F F F F F F F F
5 5 R R R R R R R R R R R R R R R R R R R R R R R R R
샘플 출력
45 0
이 문제는 dp라고 하는데, 나는 약간 사유 문제의 느낌인 것 같다.
그것의 간단한 버전을 먼저 볼 수 있다↓ 황금 광부의 제목은 별로 차이가 없다
https://blog.csdn.net/qq_38064038/article/details/78195045
이 문제의 최대 행렬을 구하면 up,left,right 그룹을 만들어서 가장 가까운 R의 위치를 기록한 다음에 직접 면적을 계산하면 됩니다~
#include
#include
#include
#include
#include
#include
#include
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
TOJ 2865 Chopsticks DPIn China, people use a pair of chopsticks to get food on the table, but Mr. L is a bit different. He uses a set of three...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.