Pro.ID1553 TitleFlooded! Title链接http://10.20.2.8/oj/exercise/problem?problem_id=1553 AC5 Submit5 Ratio100.00% 时间&空间限制描述To enable homebuyers to estimate the cost of floodinsurance, a real-estate firm provides clients with the elevation of each10-meter by 10-meter square of land in regions where homes may be purchased.Water from rain, melting snow, and burst water mains will collect first inthose squares with the lowest elevations, since water from squares of higherelevation will run downhill. For simplicity, we also assume that storm sewersenable water from high-elevation squares in valleys (completely enclosed by stillhigher elevation squares) to drain to lower elevation squares, and that waterwill not be absorbed by the land. From weather data archives, we know the typical volume of water that collectsin a region. As prospective homebuyers, we wish to know the elevation of thewater after it has collected in low-lying squares, and also the percentage ofthe region's area that is completely submerged (that is, the percentage of10-meter squares whose elevation is strictly less than the water level). Youare to write the program that provides these results. 输入The input consists of asequence of region descriptions. Each begins with a pair of integers, mand n, each less than 30, giving the dimensions of the rectangularregion in 10-meter units. Immediately following are m lines of nintegers giving the elevations of the squares in row-major order. Elevationsare given in meters, with positive and negative numbers representing elevationsabove and below sea level, respectively. The final value in each region descriptionis an integer that indicates the number of cubic meters of water that willcollect in the region. A pair of zeroes follows the description of the lastregion. 输出Description To enable homebuyers to estimate the cost of floodinsurance, a real-estate firm provides clients with the elevation of each10-meter by 10-meter square of land in regions where homes may be purchased.Water from rain, melting snow, and burst water mains will collect first inthose squares with the lowest elevations, since water from squares of higherelevation will run downhill. For simplicity, we also assume that storm sewersenable water from high-elevation squares in valleys (completely enclosed by stillhigher elevation squares) to drain to lower elevation squares, and that waterwill not be absorbed by the land. From weather data archives, we know the typical volume of water that collectsin a region. As prospective homebuyers, we wish to know the elevation of thewater after it has collected in low-lying squares, and also the percentage ofthe region's area that is completely submerged (that is, the percentage of10-meter squares whose elevation is strictly less than the water level). Youare to write the program that provides these results. Input The input consists of asequence of region descriptions. Each begins with a pair of integers, mand n, each less than 30, giving the dimensions of the rectangularregion in 10-meter units. Immediately following are m lines of nintegers giving the elevations of the squares in row-major order. Elevationsare given in meters, with positive and negative numbers representing elevationsabove and below sea level, respectively. The final value in each region descriptionis an integer that indicates the number of cubic meters of water that willcollect in the region. A pair of zeroes follows the description of the lastregion. Output For each region, display the region number (1, 2, ...), the water level (in meters above or below sealevel) and the percentage of the region's area under water, each on a separateline. The water level and percentage of the region's area under water are to bedisplayed accurate to two fractional digits. Follow the output for each region with a blank line. Sample Input 3 3 Sample Output Region 1 Author 样例输入3 3 样例输出Region 1 作者 |