首页 > 其他 > 详细

题解——Codeforces Round #508 (Div. 2) T1 (模拟)

时间:2018-09-07 10:07:07      阅读:128      评论:0      收藏:0      [点我收藏+]

依照题意暴力模拟即可A掉

#include <cstdio>
#include <algorithm>
#include <cstring>
#include <set>
using namespace std;
char s[100100];
int n,k,barrel[30];
int main(){
  scanf("%d %d",&n,&k);
  scanf("%s",s+1);
  for(int i=1;i<=n;i++)
     barrel[s[i]-A+1]++;
  int ans=0x3f3f3f3f;
  for(int i=1;i<=k;i++)
    ans=min(ans,barrel[i]);
  printf("%d\n",ans*k);
  return 0;
}

 

题解——Codeforces Round #508 (Div. 2) T1 (模拟)

原文:https://www.cnblogs.com/dreagonm/p/9602502.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!