Codeforces Round #508 (Div. 2) A. Equality

  1. problem link:http://codeforces.com/contest/1038/problem/A
  2. 题意:给你一个含有n个字符的字符串,其中该字符串由字母表的前k个字母随意组合而成。求这个字符串中从A到A+K-1个字符中最少的那个字母的数量乘以k。代码敲出来的时候刚过比赛不到7分钟,交上去就已经十分钟了,看到题目已经过了两分钟。我的电脑怕不是有毒了。
  3. 题意讲完就很简单啦。
    AC code:
#include
using namespace std;
int a[27],n,k,ans=1e8;string s;
int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    cin>>n>>k>>s;
    for(int i=0;i'A']++;
    for(int i=0;icout<

你可能感兴趣的:(codeforces)