Codeforces 844A
生活随笔
收集整理的這篇文章主要介紹了
Codeforces 844A
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
#include<cstdio>
#include<cstring>
bool cnt[30];
int main()
{
char t;
int ans=0; //重復字符數
int num=0; //字符長度
memset(cnt,false,sizeof(cnt));
while(1)
{
t=getchar();
if(t=='
')
break;
else if(cnt[(int)(t-'a')])
ans++;
else
cnt[(int)(t-'a')]=true;
num++;
}
int k;
scanf("%d",&k);
if(num<k)
printf("impossible
");
else if((num-ans)>k)
printf("0
");
else
printf("%d",k-num+ans);
return 0;
}
總結
以上是生活随笔為你收集整理的Codeforces 844A的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 学费988,入群6999,鸡汤短视频的赚
- 下一篇: 网站SEO优化要切忌的事项