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

很扯的一题 将每条边的一半权值分给它所连的两个结点

  1. #include <iostream>
  2. #include<cstdio>
  3. #include<cstring>
  4. #include<stdlib.h>
  5. #include<algorithm>
  6. using namespace std;
  7. double a[];
  8. int main()
  9. {
  10. int i,j,n,m,u,v;
  11. while(cin>>n>>m)
  12. {
  13. for(i = ; i <= n ;i++)
  14. cin>>a[i];
  15. double s;
  16. for(i = ; i <= m ; i++)
  17. {
  18. scanf("%d%d%lf",&u,&v,&s);
  19. a[u]+=s/;
  20. a[v]+=s/;
  21. }
  22. sort(a+,a+n+);
  23. double s1=,s2=;
  24. for(i = ; i <= n ;i++)
  25. {
  26. if(i%!=)
  27. s1+=a[i];
  28. else
  29. s2+=a[i];
  30. }
  31. long long k = max(s1,s2)-min(s1,s2);
  32. cout<<k<<endl;
  33. }
  34. return ;
  35. }

hduAnother Graph Game的更多相关文章

  1. [开发笔记] Graph Databases on developing

    TimeWall is a graph databases github It be used to apply mathematic model and social network with gr ...

  2. Introduction to graph theory 图论/脑网络基础

    Source: Connected Brain Figure above: Bullmore E, Sporns O. Complex brain networks: graph theoretica ...

  3. POJ 2125 Destroying the Graph 二分图最小点权覆盖

    Destroying The Graph Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 8198   Accepted: 2 ...

  4. [LeetCode] Number of Connected Components in an Undirected Graph 无向图中的连通区域的个数

    Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), ...

  5. [LeetCode] Graph Valid Tree 图验证树

    Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), ...

  6. [LeetCode] Clone Graph 无向图的复制

    Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's ...

  7. 讲座:Influence maximization on big social graph

    Influence maximization on big social graph Fanju PPT链接: social influence booming of online social ne ...

  8. zabbix利用api批量添加item,并且批量配置添加graph

    关于zabbix的API见,zabbixAPI 1item批量添加 我是根据我这边的具体情况来做的,本来想在模板里面添加item,但是看了看API不支持,只是支持在host里面添加,所以我先在一个ho ...

  9. Theano Graph Structure

    Graph Structure Graph Definition theano's symbolic mathematical computation, which is composed of: A ...

随机推荐

  1. 04_SSM框架整合(Spring+SpringMVC+MyBatis)

    [SSM的系统架构] [整合概述] 第一步: MyBatis和Spring整合,通过Spring管理mapper接口. 使用mapper的扫描器自动扫描mapper接口在Spring中进行注册. 第二 ...

  2. myeclipse 右键 Add Struts... 页面报404 错误

    网上试了很多种方法都不对,结果老师两下点出来了 我的改正方法是: 将WebRoot/WEB-INF/web.xml中的 <url-pattern>/*</url-pattern> ...

  3. From MSI to WiX, Part 2 - ARP support, by Alex Shevchuk

    Following content is directly reprinted from From MSI to WiX, Part 2 - ARP support Author: Alex Shev ...

  4. 标准C++中string类的用法

    转自博客园:http://www.cnblogs.com/xFreedom/archive/2011/05/16/2048037.html 相信使用过MFC编程的朋友对CString这个类的印象应该非 ...

  5. php header示例代码(推荐)

    <?php /*** Function: PHP header() examples (PHP) ** Desc: Some examples on how to use the header( ...

  6. [翻译][MVC 5 + EF 6] 7:加载相关数据

    原文:Reading Related Data with the Entity Framework in an ASP.NET MVC Application 1.延迟(Lazy)加载.预先(Eage ...

  7. <UNIX环境高级编程>文件共享及fork函数

    UNIX系统支持在不同进程间共享打开文件.内核使用3种数据结构表示打开文件,它们之间的关系决定了文件共享方面一个进程对另一个进程可能产生的影响. 内核维持了3个表,即进程表,文件表和v节点表.具体如下 ...

  8. Web前端新人笔记之jquery入门

    本章将为大家介绍以下几点内容: 1.jquery的主要特点: 2.建立jquery的编码环境: 3.简单jquery脚本示例: 4.选择jquery而不是纯javaScript的理由: 5.常用的jq ...

  9. 微信企业号 jsSDK wx.config报invalid signature错误,导致api接口无法使用

    最近在做公司定制化的时候发现一个问题,使用微信的语音API的时候微信报错,错误信息为:the permission value is offline verifying 但是诡异的是:同样的代码在我们 ...

  10. sae-服务器php运行环境配置

    config.yaml 语法- OPTION: ARG1 ARG2 ... - OPTION: if (CONDICTIONs) ACTION CONDITION可以是以下任意一种: 使用 == 和 ...