链接: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 }