※ 引述《Latitude (剎那間的幸福)》之銘言:
這題是我們大一下的題目,
ACM世界大學生程式設計大賽比較簡單的三題之一,
單然拉,
冠上世界程式大賽六個字就不簡單拉,
這一題演算法強一點的人,
應該是沒問題,
我們係上的同學經過提示後都有解出來,
大家試試看:
Flooded!
To enable homebuyers to estimate the cost of flood insurance, a real-estate
firm provides clients with the elevation of each 10-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 in those squares with the lowest
elevations, since water from squares of higher elevation will run downhill.
For simplicity, we also assume that storm sewers enable waer from
high-elevation squares in valleys(completely enclosed by still higher elevation
squares)to drain to lower elevation squares, and that water will not be
absorbed by the land.
From weather data archives, we know the typical volume of water that collects
in a region. As prospective homebuyers, we wish to know the elevation of the
water after it has collexted in low-lying squares, and also the percentage of
the reaion's area that is completely submerged(that is, the percentage of
10-meter squares whose elevation is strictly less than te water level). You
are to write the program that provides these results.
INPUT
The input consists of a sequence of region descriptions. Each begins with a
pair of integers, m and n , each less than 30, giving the dimensions of the
region in 10-meter units. Immediately following are m lines of n integers
giving the elevations of the squares in row-major order. Elevations are
giving in meters, with positive and negative numbers representing
elevations above and below sea level, respectively. The final value in each
region description is an integer that indicates the number of cubic meters of
water that will collect in the region. A pair of zeroes follows the description
of te last region.
OUTPUT
For each region, display the region number(1,2,...), the water level(in meters
above or below sea level)and the percentage of the region's area under water,
each on a separate line. The water level and percentage of the region's area
under water are to be displayed accurate to two fractional digits. Follow
the output for each region with a blank line.
Sample Input
3 3
25 37 45
51 12 34
94 83 27
10000
0 0
Output for the Sample Input
Region 1
Water level is 46.67 meters.
66.67 percent of the region is under water.
乎!好累!終於打完拉!粉有趣喔!大家試試看吧!
--
愛不能考慮,就憑感覺。
~巧克力情人(EN COMO AGUA PARA CHOCO LATE)
--
※ 發信站: 批踢踢實業坊(ptt.twbbs.org)
◆ From: h232.s114.ts31.
--
擁有美麗的外表是幸福的,擁有美麗的靈魂卻是痛苦的。
~茶花女
--
※ 發信站: 批踢踢實業坊(ptt.twbbs.org)
◆ From: h232.s114.ts31.