欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1728A.Colored Balls: Revisited
Colored Balls: Revisited
The title is a reference to the very first Educational Round from our writers team, Educational Round 18.
There is a bag, containing colored balls. There are different colors of balls, numbered from to . There are balls of color in the bag. The total amount of balls in the bag is odd (e. g. $\mathit{cnt}_1 + \mathit{cnt}_2 + \dots + \mathit{cnt}_n$ is odd).
In one move, you can choose two balls with different colors and take them out of the bag.
At some point, all the remaining balls in the bag will have the same color. That's when you can't make moves anymore.
Find any possible color of the remaining balls.
Input
The first line contains a single integer () — the number of testcases.
The first line of each testcase contains a single integer () — the number of colors.
The second line contains integers $\mathit{cnt}_1, \mathit{cnt}_2, \dots, \mathit{cnt}_n$ () — the amount of balls of each color in the bag.
The total amount of balls in the bag is odd (e. g. $\mathit{cnt}_1 + \mathit{cnt}_2 + \dots + \mathit{cnt}_n$ is odd).
Output
For each testcase, print a single integer — any possible color of the remaining balls, after you made some moves and can't make moves anymore.
Note
In the first testcase, your first and only move can be one of the following:
- take balls with colors and ;
- take balls with colors and ;
- take balls with colors and .
After the move, exactly one ball will remain. Its color can be or depending on the move.
In the second testcase, you can't make moves at all — there is only color of balls already. This color is .
In the third testcase, you can keep removing one ball of color and one ball of color until there are no more balls of color . At the end, three balls of color remain.
Samples
3
3
1 1 1
1
9
2
4 7
3
1
2
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |