A15384 | Password
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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).
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.
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".
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted