309838: CF1743A. Password

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Password

题意翻译

已知一个长度为四的,只包含字符 $0,1,2,\dots ,9$ 的字符串中不会出现哪些字符,求可能的字符串的数量。

题目描述

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).

输入输出格式

输入格式


The first line contains a single integer $ t $ ( $ 1 \le t \le 200 $ ) — the number of testcases. The first line of each testcase contains a single integer $ n $ ( $ 1 \le n \le 8 $ ) — the number of digits for which Monocarp remembers that they were not used in the password. The second line contains $ n $ different integers $ a_1, a_2, \dots a_n $ ( $ 0 \le a_i \le 9 $ ) representing the digits that were not used in the password. Note that the digits $ a_1, a_2, \dots, a_n $ are given in ascending order.

输出格式


For each testcase, print one integer — the number of different $ 4 $ -digit sequences that meet the constraints.

输入输出样例

输入样例 #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".

Input

题意翻译

已知一个长度为四的,只包含字符 $0,1,2,\dots ,9$ 的字符串中不会出现哪些字符,求可能的字符串的数量。

Output

题目大意:
已知一个长度为四的字符串,只包含字符0,1,2,...,9,且字符串中不会出现哪些字符,求可能的字符串的数量。

输入输出数据格式:
输入格式:
- 第一行包含一个整数t(1≤t≤200)——测试用例的数量。
- 每个测试用例的第一行包含一个整数n(1≤n≤8)——Monocarp记得的没有在密码中使用的数字的数量。
- 第二行包含n个不同的整数a1,a2,...,an(0≤ai≤9),代表没有在密码中使用的数字。注意数字a1,a2,...,an是按升序给出的。

输出格式:
- 对于每个测试用例,输出一个整数——满足条件的不同的4位数字序列的数量。

输入输出样例:
输入样例 #1:
```
2
8
0 1 2 4 5 6 8 9
1
8
```
输出样例 #1:
```
6
216
```

说明:
在第一个例子中,所有可能的密码是:"3377", "3737", "3773", "7337", "7373", "7733"。题目大意: 已知一个长度为四的字符串,只包含字符0,1,2,...,9,且字符串中不会出现哪些字符,求可能的字符串的数量。 输入输出数据格式: 输入格式: - 第一行包含一个整数t(1≤t≤200)——测试用例的数量。 - 每个测试用例的第一行包含一个整数n(1≤n≤8)——Monocarp记得的没有在密码中使用的数字的数量。 - 第二行包含n个不同的整数a1,a2,...,an(0≤ai≤9),代表没有在密码中使用的数字。注意数字a1,a2,...,an是按升序给出的。 输出格式: - 对于每个测试用例,输出一个整数——满足条件的不同的4位数字序列的数量。 输入输出样例: 输入样例 #1: ``` 2 8 0 1 2 4 5 6 8 9 1 8 ``` 输出样例 #1: ``` 6 216 ``` 说明: 在第一个例子中,所有可能的密码是:"3377", "3737", "3773", "7337", "7373", "7733"。

加入题单

算法标签: