CF770A.New Password
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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.
因诺肯季决定更改社交网络“Contact!”的密码,但他懒得自己设计新密码,因此需要你的帮助。
因诺肯季认为新密码必须满足以下条件:
- 密码长度必须恰好为 n;
- 密码只能由小写拉丁字母组成;
- 密码中不同字符的个数必须恰好为 k;
- 密码中任意两个相邻字符必须互不相同。
你的任务是帮助因诺肯季设计一个满足所有给定条件的新密码。
输入格式
The first line contains two positive integers n and k (2 ≤ n ≤ 100, 2 ≤ 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.
第一行包含两个正整数 n 和 k(2 ≤ n ≤ 100,2 ≤ k ≤ min(n, 26))—— 分别表示密码的长度以及其中不同符号的个数。
注意:所要求的新密码一定存在。
输出格式
Print any password which satisfies all conditions given by Innokentiy.
输出任意一个满足 Innokentiy 给出的所有条件的密码。
输入输出样例
输入#1
4 3
输出#1
java
输入#2
6 6
输出#2
python
输入#3
5 2
输出#3
phphp
说明/提示
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 letters p 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.
在第一个测试中,一个符合要求的新密码是 java,因为其长度为 4,且其中使用了 3 个互不相同的小写字母:a、j 和 v。
在第二个测试中,一个符合要求的新密码是 python,因为其长度为 6,且由 6 个互不相同的小写字母组成。
在第三个测试中,一个符合要求的新密码是 phphp,因为其长度为 5,且其中使用了 2 个互不相同的小写字母:p 和 h。
请注意:所有测试中符合要求的密码均满足“不存在两个相邻的相同字符”这一条件。
输入解题思路,AI测评打分。不知道怎么写?