设为首页 加入收藏

TOP

HDU-4647 Another Graph Game 贪心
2015-07-20 17:43:09 来源: 作者: 【 】 浏览:4
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+暴力)

评论

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

·Java后端面试实习自 (2025-12-25 09:24:21)
·Java LTS版本有哪些 (2025-12-25 09:24:18)
·2025年,JAVA还值得 (2025-12-25 09:24:16)
·用 C 语言或者限制使 (2025-12-25 08:50:05)
·C++构造shared_ptr为 (2025-12-25 08:50:01)