UVA 11054 Gergovia的酒交易
来源:互联网 发布:怎么手机投诉淘宝卖家 编辑:程序博客网 时间:2024/05/17 01:21
题目要求计算满足所有村庄供需所需要的最少劳动力。利用等价交换的算法设计方法将问题范围依次缩小,从而达到目的。(注意采用long long类型)
#include<cstdio>#include<cstdlib>#include<iostream>#include<cstring>#include<algorithm>#include<cmath>using namespace std;#define maxn 100005int a[maxn];int main(){//freopen("input.txt","r",stdin);int n;while(scanf("%d",&n)&&n){long long ans=0,last=0,temp;for(int i=0;i<n;i++){scanf("%lld",&temp);ans+=abs(last);last+=temp;} printf("%lld\n",ans);} return 0;}
0 0
- UVA 11054 Gergovia的酒交易
- 例题8-5 UVA 11054 Gergovia的酒交易
- uva 11054 Gergovia的酒交易 等价转化/贪心
- UVa 11054 例题8-5 Gergovia的酒交易
- 例题8-5 Gergovia的酒交易(Wine trading in Gergovia, UVa 11054)
- UVA 11054 Wine trading in Gergovia (酒的交易问题)
- Gergovia的酒交易(Uva11054,Wine trading in Gergovia)
- UVA11054:Wine trading in Gergovia(Gergovia的酒交易)
- UVA 11054 Wine trading in Gergovia 葡萄酒交易 贪心+模拟
- 例题8-5 Gergovia的酒交易 UVa11054
- 例题8-5:Gergovia的酒交易(等价转换)(贪心)
- uva 11054 Gerovia的酒交易(贪心+树状数组)
- UVa 11054 - Wine trading in Gergovia
- UVa 11054 - Wine trading in Gergovia
- uva 11054 - Wine trading in Gergovia
- uva 11054 - Wine trading in Gergovia
- UVA 11054 - Wine trading in Gergovia
- UVA 11054 Wine trading in Gergovia
- DOM(一)-04-(DHTML概述)
- VS2010/MFC编程入门之四十(文档、视图和框架:各对象之间的关系)
- 开发支付宝支付用DELPHI实现 RSA签名
- linux线程回收
- c语言实现约瑟夫环-每隔几个删除一个,求剩下的
- UVA 11054 Gergovia的酒交易
- C++中的 Round(),floor(),ceil()
- DOM(一)-05-(BOM&Navigator对象&History对象)
- Cocos2d-x 3.2中的三种缓存类
- How To Configure Expense Report Numbers? 客户化费用报表编号
- wps文档漫游 如何设置缺省不打开
- 如何在Linux上用Squid搭建代理服务器
- parentsUntil([expr|element][,filter])
- MFC对话框控件数据提取之DoDataExchange()