2.8英文题面翻译

这篇博客讲述了农场主John如何应对农场被洪水淹没的问题,特别是他的保险公司将根据农场上最大湖泊的面积来确定赔偿金额。文章描述了一个矩形网格模型,其中包含被水淹没的单元,并详细说明了湖泊形成的规则。问题转化为找出这个网格中最大湖泊的大小。
摘要由CSDN通过智能技术生成

描述

Farmer John's farm was flooded in the most recent storm, a fact only aggravated by the information that his cows are deathly afraid of water. His insurance agency will only repay him, however, an amount depending on the size of the largest "lake" on his farm.

The farm is represented as a rectangular grid with N (1 <= N <= 100) rows and M (1 <= M <= 100) columns. Each cell in the grid is either dry or submerged, and exactly K (1 <= K <= N*M) of the cells are submerged. As one would expect, a lake has a central cell to which other cells connect by sharing a long edge (not a corner). Any cell that shares a long edge with the central cell or shares a long edge with any connected cell becomes a connected cell and is part of the lake.

输入

* Line 1: Three space-separated integers: N, M, and K

* Lines 2..K+1: Line i+1 describes one submerged location with two space separated integers that are its row and column: R and C

输出

* Line 1: The number of cells that the largest lake contains.

OpenJudge - 2405:Avoid The Lakes

翻译

描述

农场主约翰的农场在最近的暴风雨中被淹没了,而他的牛非常怕水,这更加剧了这一情况。不过,他的保险公司只会根据他农场最大“湖”的大小偿还他的保险金额。

场表示为一个矩形网格,有N (1 <= N <= 100)行和M (1 <= M <= 100)列。网格中的每个单元要么是干燥的,要么是淹没的,K (1 <= K <= N*M)个单元被淹没。正如人们所预料的那样,湖泊有一个中央部分,其他部分通过共享一个长边(而不是一个角)与之连接。任何与中央部分共享长边的部分或与任何连接的部分共享长边的部分都成为连接的部分,成为湖的一部分。

输入

第一行:三个整数:M,N,K

第二行开始的K+1行:第i+1行描述了一个淹没位置,用两个用空格分隔的整数表示它的行和列:R和C

输出

最大的湖所拥有的部分数量

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值