CF2167B.Your Name
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
khba is writing his girlfriend's name. He has n cubes, each with one lowercase Latin letter written on it. They are arranged in a row, forming a string s. His girlfriend's name is also a string t, consisting of n lowercase Latin letters.
To prove his love, he must check whether it is possible to rearrange the letters of string s so that it becomes her name t.
khba 正在书写他女友的名字。他有 n 个立方体,每个立方体上写有一个小写拉丁字母。这些立方体排成一行,构成字符串 s。他女友的名字也是一个由 n 个小写拉丁字母组成的字符串 t。
为了证明他的爱意,他必须检查:能否重新排列字符串 s 中的字母,使其恰好变成他女友的名字 t。
输入格式
The first line contains an integer q (1≤q≤1000) — the number of test cases.
The first line of each test case contains an integer n (1≤n≤20).
The second line of each test case contains two distinct strings s and t, each consisting of n lowercase Latin letters.
第一行包含一个整数 q(1≤q≤1000)—— 表示测试用例的数量。
每个测试用例的第一行包含一个整数 n(1≤n≤20)。
每个测试用例的第二行包含两个互不相同的字符串 s 和 t,每个字符串均由 n 个小写拉丁字母组成。
输出格式
For each test case, output "YES" if the letters of s can be arranged to form t; otherwise, output "NO".
You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as positive responses.
对于每个测试用例,如果字符串 s 的字母可以重新排列形成 t,则输出 "YES";否则输出 "NO"。
你可以以任意大小写形式输出答案(大写或小写均可)。例如,字符串 "yEs"、"yes"、"Yes" 和 "YES" 均会被识别为肯定回答。
输入输出样例
输入#1
5 7 humitsa mitsuha 4 orhi hori 6 aakima makima 6 nezuqo nezuko 6 misaka mikasa
输出#1
YES YES NO NO YES
说明/提示
In the first example, the initial string is "humitsa", and the following operations can be performed:
- swap the first and third characters, resulting in "muhitsa"
- swap the second and fourth characters, resulting in "mihutsa"
- swap the third and fifth characters, resulting in "mithusa"
- swap the fourth and sixth characters, resulting in "mitsuha"
In the second example, the initial string is "orhi", and the following operations can be performed:
- swap the second and third characters, resulting in "ohri"
- swap the first and second characters, resulting in "hori"
在第一个例子中,初始字符串为 "humitsa",可以执行以下操作:
- 交换第一个和第三个字符,得到 "muhitsa"
- 交换第二个和第四个字符,得到 "mihutsa"
- 交换第三个和第五个字符,得到 "mithusa"
- 交换第四个和第六个字符,得到 "mitsuha"
在第二个例子中,初始字符串为 "orhi",可以执行以下操作:
- 交换第二个和第三个字符,得到 "ohri"
- 交换第一个和第二个字符,得到 "hori"
输入解题思路,AI测评打分。不知道怎么写?