A - 幸運の番号
解説
/
/
実行時間制限: 2 sec / メモリ制限: 1024 MiB
配点 : 200 点
問題文
高橋君は数字だけからなる長さ N の文字列 S で表される番号のくじを持っています。
このくじは、番号に数字の 7 が K 個以上含まれていると当たりです。高橋君のくじが当たりなら Yes を、そうでないなら No を出力してください。
制約
- 1 \leq N \leq 100
- 1 \leq K \leq 100
- S は
0から9の数字のみからなる長さ N の文字列 - N と K は整数
入力
入力は以下の形式で標準入力から与えられる。
N K S
- 1 行目には、番号の長さ N と当たりに必要な
7の個数 K がスペース区切りで与えられる。 - 2 行目には、くじの番号 S が与えられる。
出力
当たりなら Yes を、そうでないなら No を 1 行で出力せよ。
入力例 1
4 2 1777
出力例 1
Yes
入力例 2
5 1 12345
出力例 2
No
入力例 3
3 3 707
出力例 3
No
入力例 4
18 1 438174368989726894
出力例 4
Yes
入力例 5
20 28 77370003693693260017
出力例 5
No
Score : 200 pts
Problem Statement
Takahashi has a lottery ticket whose number is represented by a string S of length N consisting only of digits.
The ticket is a winner if the number contains the digit 7 at least K times. Print Yes if Takahashi's ticket is a winner, and No otherwise.
Constraints
- 1 \leq N \leq 100
- 1 \leq K \leq 100
- S is a string of length N consisting only of digits
0through9. - N and K are integers.
Input
The input is given from standard input in the following format:
N K S
- The first line contains the length of the number N and the required number of
7s K, separated by a space. - The second line contains the ticket number S.
Output
Print Yes on a single line if the ticket is a winner, and No otherwise.
Sample Input 1
4 2 1777
Sample Output 1
Yes
Sample Input 2
5 1 12345
Sample Output 2
No
Sample Input 3
3 3 707
Sample Output 3
No
Sample Input 4
18 1 438174368989726894
Sample Output 4
Yes
Sample Input 5
20 28 77370003693693260017
Sample Output 5
No