链接:https://codeforc.es/contest/1038

A题:

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 typedef long long LL;
 4 #define PI acos(-1.0)
 5 typedef pair<int,int> P;
 6 const int INF=0x3f3f3f3f;
 7 map<int,int> mp;
 8 int a[100010];
 9 int main()
10 {
11     ios::sync_with_stdio(false);
12     int n,k;
13     string s;
14     cin>>n>>k;
15     cin >> s;
16    int len = 0;
17    int ans = INF;
18    for(int i=0;i<n;i++) a[i] = s[i] - 'A',mp[a[i]]++;
19    for (int i = 0; i < k; i++) ans = min(ans, mp[i]);
20    cout << ans * k << endl;
21     
22     return 0;
23 }
View Code

相关文章:

  • 2021-12-22
  • 2021-09-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-20
  • 2021-11-12
  • 2021-10-29
  • 2021-12-11
  • 2022-01-16
  • 2022-03-08
  • 2021-05-29
相关资源
相似解决方案