博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
uva 11054 wine trading in gergovia (归纳【好吧这是我自己起的名字】)——yhx
阅读量:5088 次
发布时间:2019-06-13

本文共 1344 字,大约阅读时间需要 4 分钟。

As you may know from the comic \Asterix and the Chieftain's Shield", Gergovia consists of one street,
and every inhabitant of the city is a wine salesman. You wonder how this economy works? Simple
enough: everyone buys wine from other inhabitants of the city. Every day each inhabitant decides how
much wine he wants to buy or sell. Interestingly, demand and supply is always the same, so that each
inhabitant gets what he wants.
There is one problem, however: Transporting wine from one house to another results in work. Since
all wines are equally good, the inhabitants of Gergovia don't care which persons they are doing trade
with, they are only interested in selling or buying a specic amount of wine. They are clever enough
to gure out a way of trading so that the overall amount of work needed for transports is minimized.
In this problem you are asked to reconstruct the trading during one day in Gergovia. For simplicity
we will assume that the houses are built along a straight line with equal distance between adjacent
houses. Transporting one bottle of wine from one house to an adjacent house results in one unit of
work.
Input
The input consists of several test cases. Each test case starts with the number of inhabitants n
(2 n 100000). The following line contains n integers ai (

转载于:https://www.cnblogs.com/SBSOI/p/5575000.html

你可能感兴趣的文章
http://coolshell.cn/articles/10910.html
查看>>
[转]jsbsim基础概念
查看>>
DIV和SPAN的区别
查看>>
第一次使用cnblogs
查看>>
C#语法糖之 session操作类 asp.net
查看>>
2015 Multi-University Training Contest 3
查看>>
使用Gitblit 在windows 上部署你的Git Server
查看>>
217. Contains Duplicate
查看>>
vue2.0 关于Vue实例的生命周期
查看>>
jenkins 更换主数据目录
查看>>
Silverlight中恼人的g.i.cs错误
查看>>
SQLite 数据库增删改查
查看>>
<s:iterator>的status
查看>>
C++入门--1.0输入输出
查看>>
让搭建在Github Pages上的Hexo博客可以被Google搜索到
查看>>
Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第十四章:曲面细分阶段...
查看>>
在WPF控件上添加Windows窗口式调整大小行为
查看>>
背水一战 Windows 10 (36) - 控件(弹出类): ToolTip, Popup, PopupMenu
查看>>
打开3389
查看>>
React学习记录
查看>>