hduAnother Graph Game
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的更多相关文章
- [开发笔记] Graph Databases on developing
TimeWall is a graph databases github It be used to apply mathematic model and social network with gr ...
- Introduction to graph theory 图论/脑网络基础
Source: Connected Brain Figure above: Bullmore E, Sporns O. Complex brain networks: graph theoretica ...
- POJ 2125 Destroying the Graph 二分图最小点权覆盖
Destroying The Graph Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 8198 Accepted: 2 ...
- [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), ...
- [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), ...
- [LeetCode] Clone Graph 无向图的复制
Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's ...
- 讲座:Influence maximization on big social graph
Influence maximization on big social graph Fanju PPT链接: social influence booming of online social ne ...
- zabbix利用api批量添加item,并且批量配置添加graph
关于zabbix的API见,zabbixAPI 1item批量添加 我是根据我这边的具体情况来做的,本来想在模板里面添加item,但是看了看API不支持,只是支持在host里面添加,所以我先在一个ho ...
- Theano Graph Structure
Graph Structure Graph Definition theano's symbolic mathematical computation, which is composed of: A ...
随机推荐
- iOS 获取系统相册数据(不是调系统的相册)
Framework:AssetsLibrary.framework 主要目的是获取到系统相册的数据,并把系统相册里的照片显示出来. 1.创建一个新的项目: 2.将AssetsLibrary.frame ...
- [PR & ML 5] [Introduction] Decision Theory
- lambda表达式————一看就会
这里没有过多讲解,只有几个连接,进入看,看完后你就会觉得什么博客对lambda的介绍都是浮云,不是片面就是不准确. 链接地址: 1: https://msdn.microsoft.com/en-us/ ...
- 改善EF代码的方法(上)
本节,我们将介绍一些改善EF代码的相关方法,如NoTracking,GetObjectByKey, Include等. > MergeOption.NoTracking 当我们只需要读取某些数据 ...
- hdu 1576 A/B
原题链接:hdu 1576 A/B 同样是用扩展的欧几里得算法.A = 9973k+n = xB,从而转化为:xB-9973k=n求解x即可. 具体扩展欧几里得算法请参考:hdu 2669 Roman ...
- https证书申请
因为要为海外组的aws设置https证书,由于使用的是新的域名,所以要先申请购买证书,然后设置上去.由于是第一次做这件事.所以过程有些坎坷. 先购买https证书.看了几家,感觉GoDad ...
- 实时监听input输入框value值的变化
1.js 的 oninput & onpropertychange JS中的 oninput 事件在 IE9 以下版本不支持,需要使用 IE 特有的 onpropertychange 事件替代 ...
- Linux 源码的安装 3个步骤
http://www.oseye.net/question/96 源码的安装一般由3个步骤组成:配置(configure).编译(make).安装(make install). Configure是一 ...
- Sublime Text3注册码
这是一个注册码-– BEGIN LICENSE -– Michael Barnes Single User License EA7E-821385 8A353C41 872A0D5C DF9B2950 ...
- NGUI系列教程三
接下来我们再来看Progress Bar和Slider,对比参数我们可以发现,Progress Bar和slider的明显区别在于slider多一个Thumb选项,这里的Thumb就是我们拖动的时候点 ...