标签:oss class clu size mem getc false style bre
#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==‘\n‘) 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\n"); else if((num-ans)>k) printf("0\n"); else printf("%d",k-num+ans); return 0; }
标签:oss class clu size mem getc false style bre
原文地址:http://www.cnblogs.com/MyCodeLife-/p/7461134.html