#P9177. [COCI 2022/2023 #5] Kalendar
[COCI 2022/2023 #5] Kalendar
Problem Description
Magdalena likes calendars, and she makes her own calendar for each month.
Each day of the month is represented using exactly three characters:
- If the day number has one digit, it is written as
..X. For example, the number is written as..7. - If the day number has two digits, it is written as
.XY. For example, the number is written as.17.
Each row of the calendar represents one week, and each week has days. If a week does not contain all days (because the month may not start on Monday, or may not end on Sunday), then the missing days are shown as ....
Magdalena also wants her calendar to look nice. She will decorate it in the following way:
she will fill the top and bottom with - (ASCII 45), the left and right sides with | (ASCII 124), and the four corners with + (ASCII 43).
Your task is to determine the format of Magdalena's calendar if it has days and the first day of the month is the -th day of the week. For example, if , the month starts on Monday; if , it starts on Friday.
We assume that the first day of the week is Monday.
Input Format
One line containing integers and , representing the number of days in the month and the weekday on which the month starts.
Output Format
Output what Magdalena's calendar looks like.
31 3
+---------------------+
|........1..2..3..4..5|
|..6..7..8..9.10.11.12|
|.13.14.15.16.17.18.19|
|.20.21.22.23.24.25.26|
|.27.28.29.30.31......|
+---------------------+
1 5
+---------------------+
|..............1......|
+---------------------+
28 7
+---------------------+
|....................1|
|..2..3..4..5..6..7..8|
|..9.10.11.12.13.14.15|
|.16.17.18.19.20.21.22|
|.23.24.25.26.27.28...|
+---------------------+
Hint
| Subtask | Constraints | |
|---|---|---|
| This is the sample. | ||
| None. | ||
Translated by ChatGPT 5