CF1743A.Password
入门
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Monocarp has forgotten the password to his mobile phone. The password consists of 4 digits from 0 to 9 (note that it can start with the digit 0).
Monocarp remembers that his password had exactly two different digits, and each of these digits appeared exactly two times in the password. Monocarp also remembers some digits which were definitely not used in the password.
You have to calculate the number of different sequences of 4 digits that could be the password for Monocarp's mobile phone (i. e. these sequences should meet all constraints on Monocarp's password).
莫诺卡普忘记了他手机的密码。该密码由 4 个数字组成,每个数字取值范围为 0 到 9(注意:密码可以以数字 0 开头)。
莫诺卡普记得,他的密码中恰好包含两种不同的数字,且每种数字在密码中恰好出现两次。此外,他还记得一些绝对没有在密码中使用过的数字。
你需要计算出所有可能构成莫诺卡普手机密码的、长度为 4 的数字序列的个数(即:这些序列必须满足上述关于密码的所有约束条件)。
输入格式
The first line contains a single integer t (1≤t≤200) — the number of testcases.
The first line of each testcase contains a single integer n (1≤n≤8) — the number of digits for which Monocarp remembers that they were not used in the password.
The second line contains n different integers a1,a2,…an (0≤ai≤9) representing the digits that were not used in the password. Note that the digits a1,a2,…,an are given in ascending order.
第一行包含一个整数 t(1≤t≤200)—— 测试用例的数量。
每个测试用例的第一行包含一个整数 n(1≤n≤8)—— Monocarp 记得未在密码中使用的数字的个数。
每个测试用例的第二行包含 n 个互不相同的整数 a1,a2,…,an(0≤ai≤9),表示未在密码中使用的数字。注意,数字 a1,a2,…,an 按升序给出。
输出格式
For each testcase, print one integer — the number of different 4-digit sequences that meet the constraints.
对于每个测试用例,输出一个整数——满足约束条件的不同 4-位序列的个数。
输入输出样例
输入#1
2 8 0 1 2 4 5 6 8 9 1 8
输出#1
6 216
说明/提示
In the first example, all possible passwords are: "3377", "3737", "3773", "7337", "7373", "7733".
在第一个例子中,所有可能的密码为:“3377”、“3737”、“3773”、“7337”、“7373”、“7733”。
输入解题思路,AI测评打分。不知道怎么写?