305591: CF1060A. Phone Numbers

Memory Limit:512 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Phone Numbers

题意翻译

给出一个数字串表示你已经有的数字卡片.现在请问你用这些卡片最多能摆出多少个电话号码. 注意:卡片不能重复使用.电话号码是一个开头为$8$的$11$位数字.

题目描述

Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have $ n $ cards with digits, and you want to use them to make as many phone numbers as possible. Each card must be used in at most one phone number, and you don't have to use all cards. The phone numbers do not necessarily have to be distinct.

输入输出格式

输入格式


The first line contains an integer $ n $ — the number of cards with digits that you have ( $ 1 \leq n \leq 100 $ ). The second line contains a string of $ n $ digits (characters "0", "1", ..., "9") $ s_1, s_2, \ldots, s_n $ . The string will not contain any other characters, such as leading or trailing spaces.

输出格式


If at least one phone number can be made from these cards, output the maximum number of phone numbers that can be made. Otherwise, output 0.

输入输出样例

输入样例 #1

11
00000000008

输出样例 #1

1

输入样例 #2

22
0011223344556677889988

输出样例 #2

2

输入样例 #3

11
31415926535

输出样例 #3

0

说明

In the first example, one phone number, "8000000000", can be made from these cards. In the second example, you can make two phone numbers from the cards, for example, "80123456789" and "80123456789". In the third example you can't make any phone number from the given cards.

Input

题意翻译

给出一个数字串表示你已经有的数字卡片.现在请问你用这些卡片最多能摆出多少个电话号码. 注意:卡片不能重复使用.电话号码是一个开头为$8$的$11$位数字.

加入题单

上一题 下一题 算法标签: