YTU 1020: I think it

网友投稿 269 2022-08-30

YTU 1020: I think it

1020: I think it

时间限制: 1 Sec   内存限制: 32 MB

提交: 501

解决: 63

题目描述

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

输出

For each test case, output the answer.

样例输入

231 2 340 1 2 3

样例输出

55

#includeint jisuan(int a[],int n){ int s,ma,i,j,k,b; s=ma=a[0]; for(i=0; ima)ma=b; } for(i=0; is&&ba[j+1]) { t=a[j]; a[j]=a[j+1]; a[j+1]=t; } printf("%d\n",jisuan(a,n)); } return 0;}

总是望着曾经的空间发呆,那些说好不分开的朋友不在了,转身,陌路。 熟悉的,安静了, 安静的,离开了, 离开的,陌生了, 陌生的,消失了, 消失的,陌路了。

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:处女座的训练(贪心)
下一篇:YTU 2904: B--Faultfinding
相关文章

 发表评论

暂时没有评论,来抢沙发吧~