Type: Default 1000ms 256MiB

好孩子

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

Alice正在为他的朋友Bob的生日准备一份礼物。Alice有一个包含nn个数字的数组aa,而礼物的价值将是这些数字的乘积。因为Alice是个好孩子,她想要获得尽可能大的乘积,所以她想在其中一个数字上加上1。

Alice能够得到的最大乘积是多少?

输入格式

第一行包含一个整数tt,表示测试用例的数量。

每个测试用例的第一行包含一个整数nn,表示数字的数量。

每个测试用例的第二行包含nn个以空格分隔的整数aia_i,表示数组中的数字。

输出格式

对于每个测试用例,输出一个整数,表示Alice通过在其中一个数字上加1之后,能够得到的最大乘积,

4
4
2 2 1 2
3
0 1 2
5
4 3 2 3 4
9
9 9 9 9 9 9 9 9 9
16
2
432
430467210

提示

【数据范围】

对于所有数据,保证:$1 \leq t \leq 10^4, 1\leq n \leq 9, 0 \leq a_i \leq 9$。

C23本部国庆集训测试

Not Attended
Status
Done
Rule
IOI
Problem
7
Start at
2023-10-5 13:30
End at
2023-10-5 15:30
Duration
2 hour(s)
Host
Partic.
10