码迷,mamicode.com
首页 > 其他好文 > 详细

1008 Elevator (20分)

时间:2020-03-09 20:52:21      阅读:53      评论:0      收藏:0      [点我收藏+]

标签:cin   ace   color   +=   div   eva   bsp   using   com   

技术图片

这题...也太水了吧.。无语。

 1 #include<iostream>
 2 using namespace std;
 3 int main(){  
 4        int N,k;
 5  
 6        cin>>N;
 7        int data[N];
 8        for(int i=0;i<N;i++)
 9        {    cin>>k; 
10            data[i]=k;
11        }
12     int floor=0;
13     int time=0;
14     for(int i=0;i<N;i++)
15     {
16         if(floor>data[i])//下楼 
17              time+=(floor-data[i])*4;
18          
19         if(floor<data[i])//上楼 
20              time+=(data[i]-floor)*6;
21         
22         time+=5;
23         floor=data[i];
24     }
25     cout<<time;
26     
27 return 0;
28 }

 

1008 Elevator (20分)

标签:cin   ace   color   +=   div   eva   bsp   using   com   

原文地址:https://www.cnblogs.com/wsshub/p/12450867.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!