A16305 | Laura and Operations
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Laura is a girl who does not like combinatorics. Nemanja will try to convince her otherwise.
Nemanja wrote some digits on the board. All of them are either $1$ , $2$ , or $3$ . The number of digits $1$ is $a$ . The number of digits $2$ is $b$ and the number of digits $3$ is $c$ . He told Laura that in one operation she can do the following:
- Select two different digits and erase them from the board. After that, write the digit ( $1$ , $2$ , or $3$ ) different from both erased digits.
For example, let the digits be $1$ , $1$ , $1$ , $2$ , $3$ , $3$ . She can choose digits $1$ and $3$ and erase them. Then the board will look like this $1$ , $1$ , $2$ , $3$ . After that, she has to write another digit $2$ , so at the end of the operation, the board will look like $1$ , $1$ , $2$ , $3$ , $2$ .
Nemanja asked her whether it was possible for only digits of one type to remain written on the board after some operations. If so, which digits can they be?
Laura was unable to solve this problem and asked you for help. As an award for helping her, she will convince Nemanja to give you some points.
Nemanja wrote some digits on the board. All of them are either $1$ , $2$ , or $3$ . The number of digits $1$ is $a$ . The number of digits $2$ is $b$ and the number of digits $3$ is $c$ . He told Laura that in one operation she can do the following:
- Select two different digits and erase them from the board. After that, write the digit ( $1$ , $2$ , or $3$ ) different from both erased digits.
For example, let the digits be $1$ , $1$ , $1$ , $2$ , $3$ , $3$ . She can choose digits $1$ and $3$ and erase them. Then the board will look like this $1$ , $1$ , $2$ , $3$ . After that, she has to write another digit $2$ , so at the end of the operation, the board will look like $1$ , $1$ , $2$ , $3$ , $2$ .
Nemanja asked her whether it was possible for only digits of one type to remain written on the board after some operations. If so, which digits can they be?
Laura was unable to solve this problem and asked you for help. As an award for helping her, she will convince Nemanja to give you some points.
输入格式
Each test contains multiple test cases. The first line contains the number of test cases $t$ ( $1 \le t \le 10^5$ ). The description of the test cases follows.
The first and only line of each test case contains three integers $a$ , $b$ , $c$ ( $1 \le a, b, c \le 100$ ) — the number of ones, number of twos, and number of threes, respectively.
The first and only line of each test case contains three integers $a$ , $b$ , $c$ ( $1 \le a, b, c \le 100$ ) — the number of ones, number of twos, and number of threes, respectively.
输出格式
For each test case, output one line containing $3$ integers.
The first one should be $1$ if it is possible that after some operations only digits $1$ remain on the board, and $0$ otherwise.
Similarly, the second one should be $1$ if it is possible that after some operations only digits $2$ remain on the board, and $0$ otherwise.
Similarly, the third one should be $1$ if it is possible that after some operations only digits $3$ remain on the board, and $0$ otherwise.
The first one should be $1$ if it is possible that after some operations only digits $1$ remain on the board, and $0$ otherwise.
Similarly, the second one should be $1$ if it is possible that after some operations only digits $2$ remain on the board, and $0$ otherwise.
Similarly, the third one should be $1$ if it is possible that after some operations only digits $3$ remain on the board, and $0$ otherwise.
输入输出样例
输入 #1
3 1 1 1 2 3 2 82 47 59
输出 #1
1 1 1 0 1 0 1 0 0
In the first test case, Laura can remove digits $2$ and $3$ and write digit $1$ . After that, the board will have $2$ digits $1$ . She can make it have only digits $2$ or $3$ left by performing a similar operation.
In the second test case, she can remove digits $1$ and $3$ and write a digit $2$ . After performing that operation $2$ times, the board will have only digits $2$ left. It can be proven that there is no way to have only digits $1$ or only digits $3$ left.
In the third test case, there is a sequence of operations that leaves only digits $1$ on the board. It can be proven that there is no way to have only digits $2$ or only digits $3$ left.
In the second test case, she can remove digits $1$ and $3$ and write a digit $2$ . After performing that operation $2$ times, the board will have only digits $2$ left. It can be proven that there is no way to have only digits $1$ or only digits $3$ left.
In the third test case, there is a sequence of operations that leaves only digits $1$ on the board. It can be proven that there is no way to have only digits $2$ or only digits $3$ left.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted