A. New Password

Codeforces
IDCF770A
Time1000ms
Memory256MB
Difficulty
implementation
English · Original
Chinese · Translation
Formal · Original
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_ ≤ 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. ## Output Print **any** password which satisfies all conditions given by Innokentiy. [samples] ## 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 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.
[{"iden":"statement","content":"Innokentiy 决定更改社交网络 \"Contact!\" 的密码,但他太懒了,不想自己发明新密码。因此他需要你的帮助。\n\nInnokentiy 决定新密码应满足以下条件:\n\n你的任务是帮助 Innokentiy,发明一个满足所有给定条件的新密码。\n\n第一行包含两个正整数 #cf_span[n] 和 #cf_span[k] (#cf_span[2 ≤ n ≤ 100], #cf_span[2 ≤ k ≤ min(n, 26)]) —— 分别表示密码的长度和其中不同字符的数量。\n\n请注意,满足要求的新密码一定存在。\n\n请输出任意一个满足 Innokentiy 所有条件的密码。\n\n在第一个测试用例中,_java_ 是一个符合条件的新密码,因为其长度为 #cf_span[4],且使用了 #cf_span[3] 个不同的小写字母 _a_、_j_ 和 _v_。\n\n在第二个测试用例中,_python_ 是一个符合条件的新密码,因为其长度为 #cf_span[6],且由 #cf_span[6] 个不同的小写字母组成。\n\n在第三个测试用例中,_phphp_ 是一个符合条件的新密码,因为其长度为 #cf_span[5],且使用了 #cf_span[2] 个不同的小写字母 _p_ 和 _h_。\n\n请注意,所有测试用例中的符合条件密码均满足“无两个相同字符相邻”的条件。 "},{"iden":"input","content":"第一行包含两个正整数 #cf_span[n] 和 #cf_span[k] (#cf_span[2 ≤ n ≤ 100], #cf_span[2 ≤ k ≤ min(n, 26)]) —— 分别表示密码的长度和其中不同字符的数量。请注意,满足要求的新密码一定存在。"},{"iden":"output","content":"请输出任意一个满足 Innokentiy 所有条件的密码。"},{"iden":"examples","content":"输入\n4 3\n输出\njava\n输入\n6 6\n输出\npython\n输入\n5 2\n输出\nphphp"},{"iden":"note","content":"在第一个测试用例中,_java_ 是一个符合条件的新密码,因为其长度为 #cf_span[4],且使用了 #cf_span[3] 个不同的小写字母 _a_、_j_ 和 _v_。在第二个测试用例中,_python_ 是一个符合条件的新密码,因为其长度为 #cf_span[6],且由 #cf_span[6] 个不同的小写字母组成。在第三个测试用例中,_phphp_ 是一个符合条件的新密码,因为其长度为 #cf_span[5],且使用了 #cf_span[2] 个不同的小写字母 _p_ 和 _h_。请注意,所有测试用例中的符合条件密码均满足“无两个相同字符相邻”的条件。 "}] (注:根据要求,所有数学公式、Typst 命令如 #cf_span[n]、_java_ 等均原样保留,未做任何改动或转义,仅翻译自然语言部分。)
**Definitions** Let $ n, k \in \mathbb{Z} $ with $ 2 \leq n \leq 100 $ and $ 2 \leq k \leq \min(n, 26) $. Let $ \Sigma = \{a_1, a_2, \dots, a_k\} $ be a set of $ k $ distinct lowercase Latin letters. **Constraints** 1. The password $ P = (p_1, p_2, \dots, p_n) $ is a sequence of length $ n $ over $ \Sigma $. 2. $ |\{p_1, p_2, \dots, p_n\}| = k $ (exactly $ k $ distinct symbols are used). 3. $ p_i \neq p_{i+1} $ for all $ i \in \{1, 2, \dots, n-1\} $ (no two consecutive symbols are identical). **Objective** Construct any password $ P $ satisfying the above constraints.
Samples
Input #1
4 3
Output #1
java
Input #2
6 6
Output #2
python
Input #3
5 2
Output #3
phphp
API Response (JSON)
{
  "problem": {
    "name": "A. New Password",
    "description": {
      "content": "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 sh",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF770A"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "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.\n\nInnokentiy decides that new password sh...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "[{\"iden\":\"statement\",\"content\":\"Innokentiy 决定更改社交网络 \\\"Contact!\\\" 的密码,但他太懒了,不想自己发明新密码。因此他需要你的帮助。\\n\\nInnokentiy 决定新密码应满足以下条件:\\n\\n你的任务是帮助 Innokentiy,发明一个满足所有给定条件的新密码。\\n\\n第一行包含两个正整数 #cf_span[n] 和 #cf_span...",
      "is_translate": true,
      "language": "Chinese"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n, k \\in \\mathbb{Z} $ with $ 2 \\leq n \\leq 100 $ and $ 2 \\leq k \\leq \\min(n, 26) $.  \nLet $ \\Sigma = \\{a_1, a_2, \\dots, a_k\\} $ be a set of $ k $ distinct lowercase Latin lette...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments