[等价转换]UVa11054 - Wine trading in Gergovia
2015-09-24 03:02
585 查看
第二个村庄的需求为a1+a2
#include<bits/stdc++.h> using namespace std; int main() { int n; while(cin>>n&&n) { long long ans=0,a,last=0; for(int i=0; i<n; i++) { cin>>a; ans+=abs(last); last+=a; } cout<<ans<<endl; } return 0; }
相关文章推荐
- [问题分解]UVa11054 - Wine trading in Gergovia
- leetcode: (260) Single Number III
- 2015 Google hosts 持续更新【更新于:2015-09-22】
- leetcode: (141) Linked List Cycle
- uva 11383 - Golden Tiger Claw(完美匹配)
- HDU 3966 Aragorn's Story(树链剖分)
- First Bad Version(二分查找的应用)
- Google 开源压缩算法,要让网速更快
- MangoDB存储过程
- Google apac 在线笔试round2
- django-crontab实现Django定时任务
- django 1.8 官方文档翻译:13-1-2 使用Django认证系统
- Mongo DB的分析和应用场景
- golang基础知识之文件操作
- google drive
- 用过django就知道django的model有多方便
- [网易笔试]Best Compression Algorithms
- django 整合富文本编辑器 tiny_mce
- Hive笔记之------------基础&&实例操作(sogou 500w数据,创建一张表sogou_20111230....)
- golang 索引