A. New Password

Innokentiy decides to change the password in the social net "Contact!", but he is too lazy to invent a new password by himself. That is why he needs your help.

Innokentiy decides that new password should satisfy the following conditions:

  • the length of the password must be equal to n,
  • the password should consist only of lowercase Latin letters,
  • the number of distinct symbols in the password must be equal to k,
  • any two consecutive symbols in the password must be distinct.

Your task is to help Innokentiy and to invent a new password which will satisfy all given conditions.

Input

The first line contains two positive integers n and k (2 ≤ n ≤ 1002 ≤ k ≤ min(n, 26)) — the length of the password and the number of distinct symbols in it.

Pay attention that a desired new password always exists.

Output

Print any password which satisfies all conditions given by Innokentiy.

Examples
input
4 3
output
java
input
6 6
output
python
input
5 2
output
phphp
Note

In the first test there is one of the appropriate new passwords — java, because its length is equal to 4 and 3 distinct lowercase letters a,j and v are used in it.

In the second test there is one of the appropriate new passwords — python, because its length is equal to 6 and it consists of 6 distinct lowercase letters.

In the third test there is one of the appropriate new passwords — phphp, because its length is equal to 5 and 2 distinct lowercase lettersp and h are used in it.

Pay attention the condition that no two identical symbols are consecutive is correct for all appropriate passwords in tests.


思路:按照惯例,A题是个大水题,题意长篇大论说了那么多,其实就是一句话,请输出k种字符,共n个,并且相邻的不能相同。

看代码就知道什么意思了,,,不过多解释。

代码:

#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<stack>
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    int n,m;
    while(~scanf("%d%d",&n,&m))
    {
        int p=n/m;
        for(int j=0;j<p;j++)
        {
            for(int i=0;i<m;i++)
            printf("%c",i+'a');
        }
        n-=p*m;
        for(int i=0;i<n;i++)
            printf("%c",i+'a');
        printf("\n");
    }
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值