Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
335130 | 小林老师 | 【C3-9】电梯升降 | C++ | 通过 | 100 | 43 MS | 244 KB | 387 | 2025-07-21 21:40:58 |
#include<bits/stdc++.h> using namespace std; int main(){ int n,f,mf,t; while(cin>>n){ if(n==0) break; f=0; //当前楼层 t=0; //本次任务的总时间 for(int i=1; i<=n; i++){ cin>>mf; if(mf>f){ //上升 t=t+(mf-f)*6+5; } else{ //下降 t=t+(f-mf)*4+5; } f=mf; //更新当前楼层 } cout<<t<<endl; } return 0; }