hdu 1205吃糖果

http://acm.hdu.edu.cn/showproblem.php?pid=1205

水题一枚,糊里糊涂就过了!!

View Code
 1 #include<stdio.h>
 2 int main()
 3 {
 4     int t;
 5     int n;
 6     int x,max,sum;
 7     scanf("%d",&t);
 8     while(t--)
 9     {
10         max=0;
11         sum=0;
12         scanf("%d",&n);
13         for(int i=0;i<n;i++)
14         {
15             scanf("%d",&x);
16             if(max<x) max=x;
17             if(sum<=2000002)
18             {
19                 sum+=x;
20             }
21         }
22         if(max>sum-max+1) printf("No\n");
23         else printf("Yes\n");
24     }
25     
26 }

 

posted on 2012-10-09 19:32  仁者无敌8勇者无惧  阅读(132)  评论(0编辑  收藏  举报

导航