Bessie has wandered off the farm into the adjoining farmer's land. He raises delicious papaya fruit, which is a delicacy for cows. The papaya jungle is partitioned into a grid of squares with R rows and C columns (1
Bessie has wandered off the farm into the adjoining farmer's land. He raises delicious papaya fruit, which is a delicacy for cows. The papaya jungle is partitioned into a grid of squares with R rows and C columns (1 <= R <= 40, 1 <= C <= 40), as is popular in Wisconsin. Bessie can travel from a given square to any existing adjacent square whose route is parallel to the X or Y axis. So in the following diagram, if Bessie is at the square labeled "B", she can travel to any of the squares labeled "T": .T. TBT .T. Bessie always starts out by munching the papayas in square (row=1,col=1). After she's done with one square, Bessie always uses her trusty binoculars to count the low-hanging fruit in each of the adjacent squares. She then always moves to the square with the most visible uneaten fruit (a square that happily is always unique). Sooner or later, following this rule, Bessie always ends up in square (R,C) and eats the fruit there. Given the dimensions of the papaya jungle and the amount of fruit F_{ij} in each square (1 <= F_{ij} <= 100), determine the total number of fruit Bessie consumes for a given papaya jungle. POINTS: 80
标签: HBC24847学姐的"Helloworld!" 语言题 模拟[USACO 2009 Oct G]Papaya Jungle题解