Elevator
来源:互联网 发布:mac压缩包密码破解 编辑:程序博客网 时间:2024/06/04 01:13
http://acm.hdu.edu.cn/showproblem.php?pid=1008
#include <cstdio>int up[110],down[110];int main(){ up[0]=down[0]=0; for(int i=1;i<=100;i++) up[i]=up[i-1]+6; for(int i=1;i<=100;i++) down[i]=down[i-1]+4; int n; while(scanf("%d",&n)!=EOF&&n!=0){ int pre=0,ans=0; while(n--){ int x; scanf("%d",&x); if(x>pre){ans+=up[x-pre];ans+=5;} else {ans+=down[pre-x];ans+=5;} pre=x; } printf("%d\n",ans); } return 0;}
0 0
- Elevator
- Elevator
- Elevator
- elevator
- Elevator
- Elevator
- Elevator
- Elevator
- Elevator
- elevator
- Elevator
- Elevator
- Elevator
- Elevator
- Elevator
- Elevator
- Elevator
- Elevator
- Leetcode Q4:Median of Two Sorted Arrays
- iOS 编程 利用UIScrollView 编写无缝循环显示图片
- 黑马程序员_交通灯系统
- 数据库题——高于部门平均工资查询问题
- 时间处理
- Elevator
- vc6.0下,GDI+的配置
- Highcharts数据表示(2)
- HDU 1850 Being a Good Boy in Spring Festival(Nim博弈)
- hdu 1142 A Walk Through the Forest
- 数电模电基础(1)分压电路
- mybatis 参数为String,if test读取该参数
- C#excel、sql sever批量数据的导入导出
- 黑马程序员——Java中的String类总结