提交时间:2024-08-20 12:10:46

运行 ID: 168626

#include<cstdio> #include<cstring> char ch[35],m[35]={0,'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q', 'r','s','t','u','v','w','x','y','z'}; int s,t,w; int main() { freopen("count.in","r",stdin); freopen("count.out","w",stdout); scanf("%d%d%d",&s,&t,&w); scanf("%s",ch+1); for(int i=1;i<=5;i++) for(int j=w;j>0;j--) if(ch[j]+1<=m[t-(w-j)]) { ch[j]++; for(int k=j+1;k<=w;k++) ch[k]=ch[k-1]+1; for(int k=1;k<=w;k++) printf("%c",ch[k]); printf("\n"); break; } fclose(stdin); fclose(stdout); return 0; }