Eat candy
Time limit:6000/3000 MS (java/others) Memory limit:65535/32768 K (java/others)
Total submission (s): 26515 Accepted Submission (s): 7533
Problem Descriptionhoho, finally from Speakless hand to win all the candy, is Gardon eat candy when there is a special hobby, is not like the same candy put together to eat, like to eat first, the next time to eat another, so But Gardon don't know if there is a candy-eating order so he can finish all the candies? Please write a program to help calculate.
Input first line has an integer t, the next T-group data, each group of data accounted for 2 rows, the first row is an integer n (0<n<=1000000), the second row is n number, indicating the number of n candies Mi (0<mi<=1000000).
Output for each set of data, outputs a line that contains a "Yes" or "No".
Sample Input234 1 155 4 3 2 1
Sample Outputnoyes
HintHintplease Use function scanf
Authorgardon
Sourcegardon-dygg Contest 2
recommendjgshining | We have carefully selected several similar problems for you:1201 1021 1008 1234 1071
#include <iostream> #include <cstdio> #include <cstring> #include <string> #include <cmath > #include <cstdlib> #include <algorithm>using namespace std; #define LL long Longint Tt,n,maxx; LL Sum;int Main () { int x; scanf ("%d", &tt); while (tt--) { sum=0,maxx=0; scanf ("%d", &n); for (int i=1;i<=n;i++) { scanf ("%d", &x); sum+=x; if (X>maxx) maxx=x; } if (2*maxx-sum<=1) printf ("yes\n"); else printf ("no\n"); } return 0;}
(mathematics) Hdu 1205