September 2022 C/C++ (Level 5) real test analysis#中国电子学院#National Youth Software Programming Level Examination

insert image description here

C/C++ Programming (Level 1~8) All real questions・Click here

Problem 1: The Castle Problem

1 2 3 4 5 6 7
##############################
1 # | # | # | | #
##### —#####—#—#####—#
2 # # | # # # # #
#—#####—#####—#####—#
3 # | | # # # # #
#—#########—#####—#—#
4 # # | | | | # #
################ ##############
(Figure 1)
# = Wall
| = No wall
- = No wall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Figure 1 is the terrain of a castle picture. Please write a program to calculate how many rooms there are in the castle and how big is the largest room. The castle is divided into m×n (m≤50, n≤50) squares, and each square can have 0~4 walls.
Time limit: 1000
Memory limit: 65536
Input
The program reads data from the standard input device. Lines 1 and 2 each contain an integer &#x

Guess you like

Origin blog.csdn.net/gozhuyinglong/article/details/132631784