Dotcpp  >  编程题库  >  I think it's hard
题目 1384:

I think it's hard

时间限制: 2s 内存限制: 96MB 提交: 119 解决: 33

题目描述

Xiao Ming is only seven years old, Now I give him some numbers, and ask him what is the second
largest sum if he can choose a part of them. For example, if I give him 1 、 2 、 3 , then he should tell
me 5 as 6 is the largest and 5 is the second. I think it is too hard for him, isn ’ t it?

输入格式

Standard input will contain multiple test cases. The first line of the input is a single integer T (1 <= T <=
10) which is the number of test cases. And it will be followed by T consecutive test cases.
Each test case starts with a line containing an integer N (1<N<10) , the number I give Xiao Ming . The
second line contains N Integer numbers ai (-10<ai<10),

输出格式

For each test case, output the answer.

样例输入

2
3
1 2 3
4
0 1 2 3

样例输出

5
5

提示

零基础的同学可以先学习基础,教程见:  C语言教程C++教程编译器教程数据结构教程Python教程单片机教程

视频教学见视频网课

标签