• 欢迎访问废江网站,承蒙遇见 QQ群
  • 本站将致力于推送优质的java知识以及算法,开源代码!

Areas on the Cross-Section Diagram

AOJ 站点默认 4年前 (2020-04-09) 2636次浏览 已收录 25个评论 扫描二维码
文章目录[隐藏]

Question

NqUgv.png
Assume that rain is falling endlessly in the region and the water overflowing from the region is falling in the sea at the both sides. For example, for the above cross-section diagram, the rain will create floods which have areas of 4, 2, 1, 19 and 9 respectively.

Input
A string, which represents slopes and flatlands by ‘/’, ‘\’ and ‘_’ respectively, is given in a line. For example, the region of the above example is given by a string “\\///\_/\/\\\\/_/\\///__\\\_\\/_\/_/\”.

output
Report the areas of floods in the following format:
A
k L1 ,L2 …Lk
In the first line, print the total area A of created floods.
Nq9CU.png
Nqar0.png

Meaning

Sloution

Coding

Summary


废江博客 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:Areas on the Cross-Section Diagram
喜欢 (0)
[]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址