首页 > 学院 > 开发设计 > 正文

1008 Elevator (20)

2019-11-08 20:10:51
字体:
来源:转载
供稿:网友
#include<iostream>using namespace std;int main(){ int total; int N; cin>>N; total=N*5; int e_before=0; int e_now; for(int t=0;t<N;t++) { cin>>e_now; if(e_now>e_before) { total+=6*(e_now-e_before); } else { total+=4*(e_before-e_now); } e_before=e_now; } cout<<total<<endl;}
上一篇:COM---类厂

下一篇:PAT_1017. Queueing at Bank

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表