Logo
(追記) (追記ここまで)

6907번 - Floor Plan 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB203645432.143%

문제

The floor plan of a house shows rooms separated by walls. This floor plan can be transferred to a grid using the character I for walls and . for room space. Doorways are not shown. Each I or . character occupies one square metre.

In this diagram, there are six rooms.

You have been given the floor plan of a house and a supply of hardwood flooring. You are to determine how many rooms will have the flooring installed if you start installing the floor in the largest room first and move to the next largest room, and so on. You may not skip over any room, and you must stop when you do not have enough wood for the next room. Output the number of rooms that can have hardwood installed, and how many square metres of flooring are left over. No room will be larger than 64ドル$ square metres.

The first line contains the number of square metres of flooring you have. The second line contains an integer $r$ in range 1ドル \dots 25$ that represents the number of rows in the grid. The third line contains an integer $c$ in 1ドル \dots 25$ that represents the number of columns in the grid. The remaining $r$ lines contain $c$ characters of grid data.

입력

출력

제한

예제 입력 1

105
14
16
IIIIIIIIIIIIIIII
I......I.......I
I......III.....I
I........I.....I
I........IIIIIII
IIIIIIIIII.....I
I.I......I.....I
III..III.I.....I
I....I.IIIII...I
I....I.....III.I
I....I.......I.I
I....I.....III.I
I....I.....I...I
IIIIIIIIIIIIIIII

예제 출력 1

4 rooms, 1 square metre(s) left over

예제 입력 2

13
2
3
.I.
.I.

예제 출력 2

2 rooms, 9 square metre(s) left over

힌트

출처

Olympiad > Canadian Computing Competition & Olympiad > 2003 > CCC 2003 Junior Division 5번

Olympiad > Canadian Computing Competition & Olympiad > 2003 > CCC 2003 Senior Division 3번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /