HDU4647_Another Graph Game
有趣的博弈题。
关键在于把比边权的平分到两边的点权上面,然后点权排序,每次从大的开始拿就可以了。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define maxn 100100
using namespace std; double a[maxn];
int n,m,u,v;
double w,s1,s0; int main()
{
while (scanf("%d%d",&n,&m)!=EOF)
{
for (int i=; i<=n; i++) scanf("%lf",&a[i]);
while (m--)
{
scanf("%d%d%lf",&u,&v,&w);
w/=;
a[u]+=w,a[v]+=w;
}
sort(a+,a++n);
s1=s0=; m=;
for (int i=n; i>; i--)
{
if (m&) s0+=a[i];
else s1+=a[i];
m++;
}
printf("%.0f\n",s0-s1);
}
return ;
}
HDU4647_Another 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 ...
随机推荐
- HTML 5 +CSS3 + 原生js 做(雪花全屏飘落 + 3d旋转图)
原文:HTML 5 +CSS3 + 原生js 做(雪花全屏飘落 + 3d旋转图) 3d旋转图:主要用css3中transform属性中的rotate,translate;以及用来做舞台效果的 pers ...
- 【转载】OGRE 2.1 Windows 编译
OGRE 2.1 Windows 编译 环境: Windows 7 64Bit Visual Studio 2012 OGRE 2.1 CMake 2.8.12.1 OGRE: OGRE官方推出了最新 ...
- 关于网易云验证码V1.0版本的服务介绍
服务介绍 易盾验证码是一个用于区分人和机器的通用验证码组件.传统的字符型验证码由于存在破解率高,用户体验不友好等问题,已不适用于现今的互联网环境.易盾验证码抛弃了传统字符型验证码展示-填写字符-比对答 ...
- WCF中数据契约之已知类型的几种公开方式
WCF中传输的数据不想传统的面向对象编程,它只传递了一些对象的属性,但是自身并不知道自己属于什么对象,所以,他没有子类和父类的概念,因而也就没有Is-a的关系,所以在WCF中,如果想维持这种继承关系, ...
- javaweb(七)——HttpServletResponse对象(一)
Web服务器收到客户端的http请求,会针对每一次请求,分别创建一个用于代表请求的request对象.和代表响应的response对象.request和response对象即然代表请求和响应,那我们要 ...
- linux部署MantisBT(一)部署apache
一.部署apache 1.下载apache安装包及依赖包 http://httpd.apache.org/download.cgi#apache24(apache2)http://apr.apache ...
- Laya 自适应 不拉伸处理
Laya.init(640, Laya.Browser.width / 640 * 1028, WebGL); Laya.stage.scaleMode = "fixedwidth" ...
- Teaching Machines to Understand Us 让机器理解我们 之三 自然语言学习及深度学习的信仰
Language learning 自然语言学习 Facebook’s New York office is a three-minute stroll up Broadway from LeCun’ ...
- java之接口开发-初级篇-socket通信
socket通信实现util包类实现 public class SocketThread extends Thread { public void run() { while (true) { // ...
- [T-ARA][HUE]
歌词来源:http://music.163.com/#/song?id=22704406 wa du seu mo geum to yo do ga tae 어딜가도 스페셜한게 없어 [eo-dil ...