Kalendar
의견: 0
Magdalena likes calendars, and she makes her own calendar for each month.
Each day of the month is represented with exactly three characters:
• If the day number is sing\(le-di\)git, then it is represented as ’..X’. For example,
the number 7 is represented as ’..7’.
• If the day number is doub\(le-di\)git, then it is represented as ’.XY’. For example,
the number 17 is represented as ’.17’.
Each row of the calendar represents a week, and each week consists of 7 days. If
the week doesn’t have all the 7 days (because the month doesn’t start on Monday, or it doesn’t end on
Sunday), then the missing days are replaced with ’...’.
Magdalena also wants her calendar to be pretty. She will decorate it in the following way: she will fill
the upper and lower sides with ’-’ (ASCII 45), the left and right sides with ’|’ (ASCII 124), and the
corners with ’+’ (ASCII 43).
For example, the format of Magdalena’s calendar, when the month has 31 days and starts on Wednesday,
is the following:
+–––––––––––––––––––––+
|........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......|
+–––––––––––––––––––––+
Your task is to determine the format of Magdalena’s calendar if it has \(n\) days, and the first day of the
month is the \(x-th\) day of the week. For example, if \(x = 1\), the month starts on Monday, and if \(x = 5\), it
starts on Friday.
Note: We assume the first day of the week is Monday.
Subtask 1 (7 points): All the days will fit in a row.
Subtask 2 (19 points): \(d = 1\)
Subtask 3 (24 points): No additional constraints.
The first and only line contains integers \(n\) and \(d\) (\(1 \le n \le 99\), \(1 \le d \le 7\)), the number of days in the
month, and the day it starts with.
Print Magdalena’s calendar.
| 서브태스크 | 점수 | 설명 |
|---|---|---|
1 | 7점 | All the days will fit in a row. |
2 | 19점 | \(d = 1\) |
3 | 24점 | No additional constraints. |
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...|
+---------------------+Clarification of the second example:
Note that, although there is only one day in the month, the calendar still has the format of seven days
per row.
평가 및 의견
Kalendar
Log in to rate problems.
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Kalendar