华为OD机试真题:欢乐的周末

Python126

题目描述

小华和小为是很要好的朋友,他们约定周末一起吃饭。

通过手机通信,他们在地图上选择了多个就餐地点(其中一些由于自然地形等原因无法进入)。邱晓华和小伟能同时到达多少个就餐场所?

[En]

Through mobile phone communication, they chose multiple dining places on the map (some of them are inaccessible due to natural terrain and other reasons). How many dining places can both Qiu Xiaohua and Xiaowei reach?

输入描述

第一行输入m和n,m代表地图的长度,n代表地图的宽度。

第二行开始具体输入地图信息,地图信息包含:

0 为通畅的道路

1 为障碍物(且仅1为障碍物)

2 为小华或者小为,地图中必定有且仅有2个 (非障碍物)

3 为被选中的聚餐地点(非障碍物)

输入验证码查看隐藏内容

扫描二维码关注本站微信公众号 Johngo学长
或者在微信里搜索 Johngo学长
回复 svip 获取验证码
wechat Johngo学长