Codeforces 1038 A.

链接:http://codeforces.com/problemset/problem/1038/A

练习赛的水题,题意:找到出现最少字母的数量*k

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <fstream>
#define debug puts("-----")
#define pi (acos(-1.0))
#define eps (1e-8)
#define inf (1<<30)
using namespace std;

typedef long long ll;

int a[300];

int main(){
	int n, k; string s;
	cin>>n>>k>>s;
	for(auto c:s) a[c]++;
	cout<<*min_element(a+'A',a+'A'+k)*k<<endl;
}

猜你喜欢

转载自blog.csdn.net/weixin_43248813/article/details/82821608