A. Phone Numbers

签.

 1 #include <bits/stdc++.h>
 2 using namespace std;
 3 
 4 #define N 110
 5 char s[N];
 6 int cnt[11], n;
 7 
 8 int main()
 9 {
10     while (scanf("%d", &n) != EOF)
11     {
12         scanf("%s", s + 1);
13         memset(cnt, 0, sizeof cnt);
14         for (int i = 1; i <= n; ++i) 
15             ++cnt[s[i] - '0']; 
16         int res = 0;
17         for (int i = 1;  i <= cnt[8]; ++i)
18             res = max(res, min(i, (n - i) / 10));
19         printf("%d\n", res);
20     }
21     return 0;
22 }
View Code

相关文章:

  • 2022-12-23
  • 2022-02-26
  • 2021-11-30
  • 2021-12-25
  • 2022-12-23
  • 2021-10-13
  • 2021-12-13
  • 2022-12-23
猜你喜欢
  • 2022-02-16
  • 2021-04-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案