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

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

 #include <iostream>
#include<cstdio>
#include<cstring>
#include<stdlib.h>
#include<algorithm>
using namespace std;
double a[];
int main()
{
int i,j,n,m,u,v;
while(cin>>n>>m)
{
for(i = ; i <= n ;i++)
cin>>a[i];
double s;
for(i = ; i <= m ; i++)
{
scanf("%d%d%lf",&u,&v,&s);
a[u]+=s/;
a[v]+=s/;
}
sort(a+,a+n+);
double s1=,s2=;
for(i = ; i <= n ;i++)
{
if(i%!=)
s1+=a[i];
else
s2+=a[i];
}
long long k = max(s1,s2)-min(s1,s2);
cout<<k<<endl;
}
return ;
}

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. C# ACM poj1003

    这题很有内涵,先用简单方法 public static void acm1003(double a) { ) { return; } ; ) { / b; a = a - c; b++; } Cons ...

  2. 队列(链式存储)C++模板实现

    #include <iostream> using namespace std; //队列结点类 template <typename T> class QueueNode{ ...

  3. 关于为什么window.frames[0].src不能获取src

    在DOM文档对象模型中,window对象处于最高层,而框架除了是当前窗体的一个节点外,本身也是独立window对象,当frames作为window对象时,有name属性, 而没有src属性,只有作为节 ...

  4. PHP学习笔记(4) - 实现自己的MVC框架

    在PHP中实现一个所谓的MVC框架非常简单.这里说一下思路. 一.首先用spl_autoload_register函数实现自己的类型自动加载机制.这样其他代码都不需要再考虑如何将类所在的文件inclu ...

  5. linux正则表达式之-基础正则表达式(基于grep)

    linux正则表达式: 简单的说,正则表达式就是为处理大量的字符串而定义的一套规则和方法,如:假设@代表123456,!代表abcde.通过定义的这些特殊符号的铺助,系统管理员就可以快速的过滤,替换或 ...

  6. codeforces 8VC Venture Cup 2016 - Elimination Round C. Lieges of Legendre

    C. Lieges of Legendre 题意:给n,m表示有n个为2的倍数,m个为3的倍数:问这n+m个数不重复时的最大值 最小为多少? 数据:(0 ≤ n, m ≤ 1 000 000, n + ...

  7. windows下使用eclipse调试C程序

    一.环境描述 Eclipse IDE for C/C++ Developers version 4.4.0 MinGW  gcc/g++ version 4.8.1;gdb version 7.6.1 ...

  8. 关于《一步步学习ASP.NET MVC3》系列发布时间的说明

    在写这个系列的时候,老魏也是下了很大的决心,因为平时基本上没有时间写文章,这回我要挑战我自己的意志力,决定要把这个系列写完整. 再次呢,老魏不能向大家保证什么时间结束,但基本上要保持一天一篇的进度,如 ...

  9. Statusbar出现透明及界面下方出现空白

    步骤1.在ViewController中 loadView   #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 if ( IOS7_OR_LATER ) ...

  10. CODEVS 1073 家族

    题目描述 Description 若某个家族人员过于庞大,要判断两个是否是亲戚,确实还很不容易,现在给出某个亲戚关系图,求任意给出的两个人是否具有亲戚关系. 规定:x和y是亲戚,y和z是亲戚,那么x和 ...