码迷,mamicode.com
首页 > 其他好文 > 详细

XDOJ_1082_图的最大边数

时间:2016-10-22 07:46:03      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:problem   class   can   ios   space   long   #include   pre   ret   

http://acm.xidian.edu.cn/problem.php?id=1082

 

不能有环。

 

#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;

int n;

int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        long long maxx = 0,sum = 0,temp;
        scanf("%d",&n);
        while(n--)
        {
            scanf("%lld",&temp);
            maxx = max(maxx,temp);
            sum += temp;
        }
        printf("%lld\n",min(sum/2,sum-maxx));
    } 
    return 0;
}

 

XDOJ_1082_图的最大边数

标签:problem   class   can   ios   space   long   #include   pre   ret   

原文地址:http://www.cnblogs.com/zhurb/p/5986612.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!