Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int t;
- scanf("%d",&t);
- while(t--){
- char c[1000];
- int n,k;
- scanf("%d %d",&n,&k);
- int cnt=n/k;
- int mod=n%k;
- int i=0,j;
- c[0]='a';
- while(i<n-mod){
- for(j=0;j<cnt;j++){
- c[i+1]=c[i];
- i++;
- }
- c[i]=c[i]+1;
- }
- char d='a'-1;
- while(i<n){
- c[i]=d+1;
- i++;
- d=d+1;
- }
- for(j=0;j<n;j++)
- printf("%c",c[j]);
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement