No.2109 Special Week
Problem Statement
A week is called a Special Week if the total of $7$ days from its Monday through its Sunday satisfy the following condition.
- When the dates of all $7$ days are written in the format
mm/dd, at least $K$ of the $10$ kinds of digits $0,1,\ldots,9$ each appear at least $1$ time in total somewhere among them.
In the mm/dd format, for example, day $2$ of month $5$ is written as 05/02, and day $28$ of month $11$ is written as 11/28.
Today is day $D$ of month $M$, and it is a Monday. Is this week a Special Week? Assume that this year is not a leap year.
Input
$M\ D\ K$
- $1\le M\le 12$
- $1\le D\le 31$
- $1\le K\le 10$
- Day $D$ of month $M$ is a date that actually exists.
- All inputs are integers.
Output
Print Yes if this week is a Special Week, and No otherwise.
Sample
Sample 1
Input
12 3 10
Output
Yes
The dates from day $3$ of month $12$ through day $9$ of month $12$, written in the mm/dd format, are 12/03,12/04,12/05,12/06,12/07,12/08,12/09, respectively.
Among these, $0,1,2$ appear $7$ times each and $3,4,5,6,7,8,9$ appear $1$ time each, so every digit appears at least $1$ time. Therefore, this week is a Special Week.
Sample 2
Input
11 28 6
Output
Yes
The week may span two months.
The digits that appear in any of 11/28,11/29,11/30,12/01,12/02,12/03,12/04 are the $7$ kinds $0,1,2,3,4,8,9$.
This is at least $K=6$, so this week is a Special Week.
Sample 3
Input
12 26 9
Output
No
The week may span two years.
The digits that appear in any of 12/26,12/27,12/28,12/29,12/30,12/31,01/01 are the $8$ kinds $0,1,2,3,6,7,8,9$.
This is less than $K=9$, so this week is not a Special Week.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
bayashiko