avatar
国足欢迎你! (转载)# Joke - 肚皮舞运动
p*u
1
A group of farmers has some elevation data, and we’re going to help them
understand how rainfall flows over their farmland. We’ll represent the land
as a two-dimensional array of altitudes and use the following model, based
on the idea that water flows downhill:
If a cell’s four neighboring cells all have higher altitudes, we call this
cell a sink; water collects in sinks. Otherwise, water will flow to the
neighboring cell with the lowest altitude. If a cell is not a sink, you may
assume it has a unique lowest neighbor and that this neighbor will be lower
than the cell.
请给个答案吧
Cells that drain into the same sink – directly or indirectly – are said to
be part of the same basin.
Your challenge is to partition the map into basins. In particular, given a
map of elevations, your code should partition the map into basins and output
the sizes of the basins, in descending order.
Assume the elevation maps are square. Input will begin with a line with one
integer, S, the height (and width) of the map. The next S lines will each
contain a row of the map, each with S integers – the elevations of the S
cells in the row. Some farmers have small land plots such as the examples
below, while some have larger plots. However, in no case will a farmer have
a plot of land larger than S = 5000.
Your code should output a space-separated list of the basin sizes, in
descending order. (Trailing spaces are ignored.)
A few examples are below.
Input:
3
1 5 2
2 4 7
3 6 9
Output: 7 2
avatar
h*q
2
for buy two get $5 reward.
if I buy online will I still get the $5 reward?
Thanks!!!
avatar
b*7
3
【 以下文字转载自 Soccer 讨论区 】
发信人: baozi777 (test), 信区: Soccer
标 题: 国足欢迎你!
发信站: BBS 未名空间站 (Fri Jun 27 18:31:22 2014, 美东)
来自: 卡卡西 2008-08-15 19:54:25
我家球门常打开
开怀容纳天地
一个两个不算稀奇
再多也输得起
天大地大都是朋友
请不用客气
场上梦游是惯例
场下才牛气
国足欢迎你
用净剩球感动你
你们捞足积分
我们来出局
国足欢迎你
遇到中国就是福气
业余联队一样能晋级
我家球门常打开
要进几个随你
交锋过后就有了底
你会爱上这里
不管远近都是客人
请不用客气
进的少了别在意
下次补给你
国足欢迎你
为你敞开球门
再不济的实力
也能找信心
国足欢迎你
遇上了您就随便赢
有我们就会有奇迹
avatar
c*e
4
深度优先或者广度优先搜索都可以吧
唯一特别的,可能是每次开始搜索时,给搜索编个号
比如第一次从[0][0]开始搜索,把自己能流到,以及能流到自己的格子都标记为1号
直到搜索完成
然后找到另一块还没有标记为1的格子,标记为2,再从他开始搜索
直到所有格子都有标记了,就结束了
avatar
b*9
5
how?
it printed directly on the catalina

【在 h******q 的大作中提到】
: for buy two get $5 reward.
: if I buy online will I still get the $5 reward?
: Thanks!!!

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。