设为首页 加入收藏

TOP

HDU-4647 Another Graph Game 贪心
2015-07-20 17:43:09 来源: 作者: 【 】 浏览:3
Tags:HDU-4647 Another Graph Game 贪心

将边权拆成两半加到它所关联的两个点的点权中即可。因为当两个人分别选择不同的点时,这一权值将互相抵消。然后排序从最优开始取。

#include 
  
   
#include 
   
     #include 
    
      #include 
     
       #include 
      
        #include 
       
         #include 
        
          #include 
         
           #define LL long long using namespace std; const int maxn=110000; bool cmp(LL a, LL b) { return a>b; } LL n,m; LL w[maxn]; int main() { LL u,v,l; while(scanf("%I64d%I64d",&n,&m)!=EOF) { for(LL i=1;i<=n;i++) { scanf("%I64d",&w[i]); w[i]*=2ll; } for(LL i=0;i
          
           

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇[ThinkingInC++]47、关于宏的使用.. 下一篇zoj 3817 Chinese Knot(hash+暴力)

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·C++中智能指针的性能 (2025-12-25 03:49:29)
·如何用智能指针实现c (2025-12-25 03:49:27)
·如何在 C 语言中管理 (2025-12-25 03:20:14)
·C语言和内存管理有什 (2025-12-25 03:20:11)
·为什么C语言从不被淘 (2025-12-25 03:20:08)